| Bug #90519 | Typo in conversion.py:648 causes LONG_BLOB to converted to JSON | ||
|---|---|---|---|
| Submitted: | 20 Apr 2018 2:09 | Modified: | 10 May 2022 21:11 |
| Reporter: | Ben Jolitz | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / Python | Severity: | S2 (Serious) |
| Version: | 8.0.11 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[20 Apr 2018 5:00]
MySQL Verification Team
Hello Ben, Thank you for the report! Thanks, Umesh
[10 May 2022 21:11]
Philip Olson
Fixing a bug syncing issue, here's what was written: --- Fixed as of the upcoming MySQL Connector/Python 8.0.16 release, and here's the changelog entry: Querying an empty LONG BLOB raised an IndexError. Thank you for the bug report. --- Setting status to closed.

Description: Last paragraph of conversion.py reads as: ``` def _BLOB_to_python(self, value, dsc=None): # pylint: disable=C0103 """Convert BLOB data type to Python""" if dsc is not None: if dsc[7] & FieldFlag.BINARY: if PY2: return value return bytes(value) return self._STRING_to_python(value, dsc) _LONG_BLOB_to_python = _JSON_to_python _MEDIUM_BLOB_to_python = _BLOB_to_python _TINY_BLOB_to_python = _BLOB_to_python ``` Permalink on GitHub: https://github.com/mysql/mysql-connector-python/blob/0e84955ecfb53d3b477584557e8345c6427a1... Notice how LONG BLOB is incorrectly cast to JSON as opposed to BLOB? This causes empty LONG BLOBs to throw an IndexError How to repeat: SELECT a column of empty LONG BLOBs or CAST a value to a 0 byte length LONG BLOB. Suggested fix: Use _BLOB_to_python instead for _LONG_BLOB_to_python