During a dump or reload, long BLOB (binary large object) values could be corrupted if they exceeded the maximum packet size set for MySQL. This update corrects the erroneous logic that caused incorrect insertion of a newline, resolving this issue.
Created attachment 379162[details]
Proposed patch
Description of problem:
When importing large blobs (larger than the value of the mysql
client's max_allowed_packet), extra invalid characters will be added
to the data.
Version-Release number of selected component (if applicable):
mysql-5.0.77-3.el5
How reproducible:
100%
Steps to Reproduce:
1) Increase the value of the server's max_allowed_packet option to a
sufficiently large value by adding the following to /etc/my.cnf
max_allowed_packet=16777216
and then restarting the mysql daemon.
2) Run the following:
# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database test_db;
Query OK, 1 row affected (0.00 sec)
mysql> use test_db;
Database changed
mysql> create table t1 (data longblob);
Query OK, 0 rows affected (0.01 sec)
mysql> insert into t1 select repeat('1', 2*1024*1024);
Query OK, 1 row affected (0.03 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> select length(data) from t1;
+--------------+
| length(data) |
+--------------+
| 2097152 |
+--------------+
1 row in set (0.00 sec)
mysql> exit
Bye
# mysqldump test_db t1 > test_db-t1.sql
# mysql test_db --max_allowed_packet=1M < test_db-t1.sql
# mysql test_db
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select length(data) from t1;
+--------------+
| length(data) |
+--------------+
| 2097153 |
+--------------+
1 row in set (0.00 sec)
mysql>
Actual results:
The entered into the table is different than what was extracted
using the mysqldump command.
Expected results:
The data should be the same.
Additional info:
This is upstream MySQL bug 41486 (http://bugs.mysql.com/bug.php?id=41486).
The attached patch is the fix for that issue backported to
mysql-5.0.77-3. The patch seems to have resolved the issue -- the
built-in tests passed and the build was successful.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
During a dump or reload, long BLOB (binary large object) values could be corrupted if they exceeded the maximum packet size set for MySQL. This update corrects the erroneous logic that caused incorrect insertion of a newline, resolving this issue.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
http://rhn.redhat.com/errata/RHSA-2013-0121.html