#At file:///home/gluh/MySQL/mysql-5.1/ based on revid:sergey.glukhov@stripped
3659 Sergey Glukhov 2011-04-14
Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
Some multibyte sequences could be considered by my_mbcharlen() functions
as multibyte character but more exact my_ismbchar() does not think so.
In such a case this multibyte sequences is pushed into 'stack' buffer which
is too small to accommodate the sequence.
The fix is to allocate stack buffer in
compliance with max character length.
@ mysql-test/r/loaddata.result
test case
@ mysql-test/std_data/bug11765139.dat
data file for test case
@ mysql-test/t/loaddata.test
test case
@ sql/sql_load.cc
allocate stack buffer in compliance with max character length.
added:
mysql-test/std_data/bug11765139.dat
modified:
mysql-test/r/loaddata.result
mysql-test/t/loaddata.test
sql/sql_load.cc
=== modified file 'mysql-test/r/loaddata.result'
--- a/mysql-test/r/loaddata.result 2010-07-14 11:54:51 +0000
+++ b/mysql-test/r/loaddata.result 2011-04-14 13:28:54 +0000
@@ -532,4 +532,10 @@ a
0
1
DROP TABLE t1;
+#
+# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
+#
+CREATE TABLE t1(f1 INT);
+LOAD DATA INFILE '../../std_data/bug11765139.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
+DROP TABLE t1;
End of 5.1 tests
=== added file 'mysql-test/std_data/bug11765139.dat'
Binary files a/mysql-test/std_data/bug11765139.dat 1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug11765139.dat 2011-04-14 13:28:54 +0000 differ
=== modified file 'mysql-test/t/loaddata.test'
--- a/mysql-test/t/loaddata.test 2010-07-14 11:54:51 +0000
+++ b/mysql-test/t/loaddata.test 2011-04-14 13:28:54 +0000
@@ -611,5 +611,14 @@ DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
+--echo #
+--echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
+--echo #
+
+CREATE TABLE t1(f1 INT);
+--disable_warnings
+LOAD DATA INFILE '../../std_data/bug11765139.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
+--enable_warnings
+DROP TABLE t1;
--echo End of 5.1 tests
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2010-12-17 13:05:50 +0000
+++ b/sql/sql_load.cc 2011-04-14 13:28:54 +0000
@@ -1109,7 +1109,7 @@ READ_INFO::READ_INFO(File file_par, uint
/* Set of a stack for unget if long terminators */
- uint length=max(field_term_length,line_term_length)+1;
+ uint length=max(field_term_length,line_term_length) * cs->mbmaxlen + 1;
set_if_bigger(length,line_start.length());
stack=stack_pos=(int*) sql_alloc(sizeof(int)*length);
Attachment: [text/bzr-bundle] bzr/sergey.glukhov@oracle.com-20110414132854-ugsrf9ozqvrdvlnx.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (sergey.glukhov:3659) Bug#11765139 | Sergey Glukhov | 14 Apr |