List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:November 19 2010 3:51pm
Subject:bzr commit into mysql-trunk-bugfixing branch (bar:3372)
View as plain text  
#At file:///home/bar/mysql-bzr/mysql-trunk-bugfixing/ based on revid:georgi.kodinov@stripped

 3372 Alexander Barkov	2010-11-19 [merge]
      Merging from mysql-5.5-bugteam

    modified:
      mysql-test/r/xml.result
      mysql-test/t/xml.test
      sql/item.cc
=== modified file 'mysql-test/r/xml.result'
--- a/mysql-test/r/xml.result	2010-11-18 13:11:18 +0000
+++ b/mysql-test/r/xml.result	2010-11-19 15:24:29 +0000
@@ -1101,3 +1101,16 @@ ERROR 22007: Illegal double '11111111111
 SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
 ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
 End of 5.1 tests
+#
+# Start of 5.5 tests
+#
+#
+# Bug#58175 xml functions read initialized bytes when conversions happen
+#
+SET NAMES latin1;
+SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
+UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0)
+NULL
+#
+# End of 5.5 tests
+#

=== modified file 'mysql-test/t/xml.test'
--- a/mysql-test/t/xml.test	2010-11-18 13:11:18 +0000
+++ b/mysql-test/t/xml.test	2010-11-19 15:24:29 +0000
@@ -628,3 +628,18 @@ SELECT EXTRACTVALUE('', LPAD(0.1111E-15,
 
 
 --echo End of 5.1 tests
+
+
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+--echo #
+--echo # Bug#58175 xml functions read initialized bytes when conversions happen
+--echo #
+SET NAMES latin1;
+SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
+
+--echo #
+--echo # End of 5.5 tests
+--echo #

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2010-11-18 14:14:31 +0000
+++ b/sql/item.cc	2010-11-19 15:49:46 +0000
@@ -5622,10 +5622,27 @@ static uint nr_of_decimals(const char *s
       break;
   }
   decimal_point= str;
-  for (; my_isdigit(system_charset_info, *str) ; str++)
+  for ( ; str < end && my_isdigit(system_charset_info, *str) ; str++)
     ;
-  if (*str == 'e' || *str == 'E')
+  if (str < end && (*str == 'e' || *str == 'E'))
     return NOT_FIXED_DEC;
+  /*
+    QQ:
+    The number of decimal digist in fact should be (str - decimal_point - 1).
+    But it seems the result of nr_of_decimals() is never used!
+
+    In case of 'e' and 'E' nr_of_decimals returns NOT_FIXED_DEC.
+    In case if there is no 'e' or 'E' parser code in sql_yacc.yy
+    never calls Item_float::Item_float() - it creates Item_decimal instead.
+
+    The only piece of code where we call Item_float::Item_float(str, len)
+    without having 'e' or 'E' is item_xmlfunc.cc, but this Item_float
+    never appears in metadata itself. Changing the code to return
+    (str - decimal_point - 1) does not make any changes in the test results.
+
+    This should be addressed somehow.
+    Looks like a reminder from before real DECIMAL times.
+  */
   return (uint) (str - decimal_point);
 }
 


Attachment: [text/bzr-bundle] bzr/bar@mysql.com-20101119154946-pt5brhpy2yhi5a0d.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (bar:3372) Alexander Barkov19 Nov