List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:January 13 2011 3:55pm
Subject:bzr commit into mysql-trunk branch (alexander.barkov:3502) Bug#59145
View as plain text  
#At file:///home/bar/mysql-bzr/mysql-trunk/ based on revid:luis.soares@stripped

 3502 Alexander Barkov	2011-01-13
      Bug#59145 valgrind warnings for uninitialized values in my_strtoll10_mb2
     @ mysql-test/r/ctype_ucs.result
        Adding test
     @ mysql-test/t/ctype_ucs.test
        Adding test
     @ strings/ctype-ucs2.c
        "wc" was not initialized in case of empty string.
        - Removing redundant loop condition in for - on end-of-string
          the loop will break by "goto".
        - Making "goto" condition stricter (just in case)

    modified:
      mysql-test/r/ctype_ucs.result
      mysql-test/t/ctype_ucs.test
      strings/ctype-ucs2.c
=== modified file 'mysql-test/r/ctype_ucs.result'
--- a/mysql-test/r/ctype_ucs.result	2010-12-02 17:47:56 +0000
+++ b/mysql-test/r/ctype_ucs.result	2011-01-13 15:55:41 +0000
@@ -4620,5 +4620,18 @@ ae	00610065
 drop table t1;
 "END ctype_german.inc"
 #
+# Bug#59145 valgrind warnings for uninitialized values in my_strtoll10_mb2
+#
+SET NAMES latin1;
+SELECT CONVERT(CHAR(NULL USING ucs2), UNSIGNED);
+CONVERT(CHAR(NULL USING ucs2), UNSIGNED)
+0
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: ''
+DO IFNULL(CHAR(NULL USING ucs2), '');
+DO CAST(CONVERT('' USING ucs2) AS UNSIGNED);
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: ''
+#
 # End of 5.6 tests
 #

=== modified file 'mysql-test/t/ctype_ucs.test'
--- a/mysql-test/t/ctype_ucs.test	2010-06-25 12:00:49 +0000
+++ b/mysql-test/t/ctype_ucs.test	2011-01-13 15:55:41 +0000
@@ -765,5 +765,13 @@ SET collation_connection=ucs2_german2_ci
 --source include/ctype_german.inc
 
 --echo #
+--echo # Bug#59145 valgrind warnings for uninitialized values in my_strtoll10_mb2
+--echo #
+SET NAMES latin1;
+SELECT CONVERT(CHAR(NULL USING ucs2), UNSIGNED);
+DO IFNULL(CHAR(NULL USING ucs2), '');
+DO CAST(CONVERT('' USING ucs2) AS UNSIGNED);
+
+--echo #
 --echo # End of 5.6 tests
 --echo #

=== modified file 'strings/ctype-ucs2.c'
--- a/strings/ctype-ucs2.c	2010-12-17 11:28:59 +0000
+++ b/strings/ctype-ucs2.c	2011-01-13 15:55:41 +0000
@@ -727,10 +727,10 @@ my_strtoll10_mb2(CHARSET_INFO *cs,
   {
     /* Make sure string length is even */
     end= s + ((*endptr - s) / 2) * 2;
-    for ( ; s < end; ) /* Skip leading spaces and tabs */
+    for ( ; ; ) /* Skip leading spaces and tabs */
     {
       res= cs->cset->mb_wc(cs, &wc, (const uchar *) s, (const uchar *) end);
-      if (res < 0)
+      if (res <= 0)
         goto no_conv;
       s+= res;
       if (wc != ' ' && wc != '\t')


Attachment: [text/bzr-bundle] bzr/alexander.barkov@oracle.com-20110113155541-679xw68rc94e6z7u.bundle
Thread
bzr commit into mysql-trunk branch (alexander.barkov:3502) Bug#59145Alexander Barkov13 Jan