Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-7591

A value that does not fit the column buffer is not read correctly over ODBC

    XMLWordPrintable

Details

    • MXS-SPRINT-279
    • Can result in data loss
    • Hide
      A value too large for the buffer derived from the column metadata, which is capped at one megabyte, was not read correctly over ODBC and had to be read in parts, which never worked. Measured with MariaDB Connector/ODBC, a LONGTEXT of 1048576 bytes or more failed the read with HY090 "Invalid string or buffer length", a LONGBLOB of 1048577 bytes was returned as a single byte and one of 2097152 bytes as 1048576 bytes, the latter two without any error being reported, so an ETL of a blob larger than a megabyte silently wrote a truncated value. Such a value is now read in full with repeated calls, including from a driver that does not report how much data remains.
      Show
      A value too large for the buffer derived from the column metadata, which is capped at one megabyte, was not read correctly over ODBC and had to be read in parts, which never worked. Measured with MariaDB Connector/ODBC, a LONGTEXT of 1048576 bytes or more failed the read with HY090 "Invalid string or buffer length", a LONGBLOB of 1048577 bytes was returned as a single byte and one of 2097152 bytes as 1048576 bytes, the latter two without any error being reported, so an ETL of a blob larger than a megabyte silently wrote a truncated value. Such a value is now read in full with repeated calls, including from a driver that does not report how much data remains.

    Description

      Reading a value in parts over ODBC does not work. The retry loop in ODBCImp::get_normal_result() resizes the buffer to the number of bytes still available instead of to that plus what has already been stored, subtracts a string terminator from a binary offset, and leaves the indicator holding the length of the last piece rather than of the whole value.

      A value is read in parts when it exceeds the buffer sized from the column metadata, which is capped at one megabyte. Measured with MariaDB Connector/ODBC:

      • LONGTEXT of 1048576 bytes or more: the read fails with HY090 "Invalid string or buffer length".
      • LONGBLOB of 1048577 bytes: 1 byte is returned and no error is reported.
      • LONGBLOB of 2097152 bytes: 1048576 bytes are returned and no error is reported.

      The two blob cases are silent data corruption, so an ETL of a blob larger than a megabyte has been writing truncated values.

      Attachments

        Activity

          People

            johan.wikman Johan Wikman
            johan.wikman Johan Wikman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.5d
                0.5d

                Git Integration

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