Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1339

Add maxAllowedColumns option to bound server-announced column count

    XMLWordPrintable

Details

    Description

      When reading result-set or prepare metadata, the driver allocates a ColumnDecoder array sized to the column count announced by the server (a length-encoded integer, up to Integer.MAX_VALUE). A malicious man-in-the-middle proxy can announce an enormous column count to force a huge allocation and exhaust client memory (OOM), before any actual column packets are read.

      Add a new connection option maxAllowedColumns (default 65535) that rejects the command with an SQLException when the announced column count exceeds the limit, before allocating. 65535 matches the wire-format cap already imposed on prepare-statement column/param counts.

      MariadDB/MySQL tables columns limit is 4k (1017 for InnoDB), so 64K limit is ok.

      thanks fg0x0 for report

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.