List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:April 15 2011 8:51am
Subject:bzr commit into mysql-5.1 branch (sergey.glukhov:3661) Bug#11765139
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.1/ based on revid:tor.didriksen@stripped

 3661 Sergey Glukhov	2011-04-15
      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/t/loaddata.test
        test case
     @ sql/sql_load.cc
        allocate stack buffer in compliance with max character length.

    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-15 08:51:34 +0000
@@ -532,4 +532,11 @@ 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);
+SELECT 0xE1BB30 INTO OUTFILE 't1.dat';
+LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
+DROP TABLE t1;
 End of 5.1 tests

=== 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-15 08:51:34 +0000
@@ -611,5 +611,18 @@ 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);
+EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat';
+--disable_warnings
+LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
+--enable_warnings
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/t1.dat;
 
 --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-15 08:51:34 +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(cs->mbmaxlen, max(field_term_length, line_term_length)) + 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-20110415085134-f28fgp16937b2li4.bundle
Thread
bzr commit into mysql-5.1 branch (sergey.glukhov:3661) Bug#11765139Sergey Glukhov15 Apr