Details
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.