List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:November 18 2010 1:45pm
Subject:bzr commit into mysql-trunk branch (bar:3351)
View as plain text  
#At file:///home/bar/mysql-bzr/mysql-trunk-bugfixing/ based on revid:alexander.nozdrin@stripped

 3351 Alexander Barkov	2010-11-18 [merge]
      Merging from mysql-5.5-bugteam

    modified:
      mysql-test/r/xml.result
      mysql-test/t/xml.test
      sql/item.cc
      sql/sql_acl.cc
=== modified file 'mysql-test/r/xml.result'
--- a/mysql-test/r/xml.result	2009-07-10 23:12:13 +0000
+++ b/mysql-test/r/xml.result	2010-11-18 13:11:18 +0000
@@ -1093,4 +1093,11 @@ Warnings:
 Warning	1525	Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
 Warning	1525	Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
 DROP TABLE t1;
+#
+# Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
+#
+SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
+ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
+SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
+ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
 End of 5.1 tests

=== modified file 'mysql-test/t/xml.test'
--- a/mysql-test/t/xml.test	2009-07-10 23:12:13 +0000
+++ b/mysql-test/t/xml.test	2010-11-18 13:11:18 +0000
@@ -617,4 +617,14 @@ FROM t1 ORDER BY t1.id;
 
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
+--echo #
+
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
+
+
 --echo End of 5.1 tests

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2010-11-14 18:09:32 +0000
+++ b/sql/item.cc	2010-11-18 13:44:06 +0000
@@ -5631,8 +5631,17 @@ static uint nr_of_decimals(const char *s
 
 
 /**
-  This function is only called during parsing. We will signal an error if
-  value is not a true double value (overflow)
+  This function is only called during parsing:
+  - when parsing SQL query from sql_yacc.yy
+  - when parsing XPath query from item_xmlfunc.cc
+  We will signal an error if value is not a true double value (overflow):
+  eng: Illegal %s '%-.192s' value found during parsing
+  
+  Note: the string is NOT null terminated when called from item_xmlfunc.cc,
+  so this->name will contain some SQL query tail behind the "length" bytes.
+  This is Ok for now, as this Item is never seen in SHOW,
+  or EXPLAIN, or anywhere else in metadata.
+  Item->name should be fixed to use LEX_STRING eventually.
 */
 
 Item_float::Item_float(const char *str_arg, uint length)
@@ -5643,12 +5652,9 @@ Item_float::Item_float(const char *str_a
                     &error);
   if (error)
   {
-    /*
-      Note that we depend on that str_arg is null terminated, which is true
-      when we are in the parser
-    */
-    DBUG_ASSERT(str_arg[length] == 0);
-    my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", (char*) str_arg);
+    char tmp[NAME_LEN + 1];
+    my_snprintf(tmp, sizeof(tmp), "%.*s", length, str_arg);
+    my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", tmp);
   }
   presentation= name=(char*) str_arg;
   decimals=(uint8) nr_of_decimals(str_arg, str_arg+length);

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2010-11-03 14:31:27 +0000
+++ b/sql/sql_acl.cc	2010-11-18 13:44:06 +0000
@@ -9298,8 +9298,8 @@ acl_authenticate(THD *thd, uint connect_
   2. client sends the encrypted password back to the server
   3. the server checks the password.
 */
-static int native_password_authenticate(MYSQL_PLUGIN_VIO *vio, 
-                                              MYSQL_SERVER_AUTH_INFO *info)
+static int native_password_authenticate(MYSQL_PLUGIN_VIO *vio,
+                                        MYSQL_SERVER_AUTH_INFO *info)
 {
   uchar *pkt;
   int pkt_len;
@@ -9313,7 +9313,7 @@ static int native_password_authenticate(
 
   /* send it to the client */
   if (mpvio->write_packet(mpvio, (uchar*) mpvio->scramble, SCRAMBLE_LENGTH + 1))
-    return CR_ERROR;
+    DBUG_RETURN(CR_ERROR);
 
   /* reply and authenticate */
 


Attachment: [text/bzr-bundle] bzr/bar@mysql.com-20101118134406-ks3wd42ypyx2undl.bundle
Thread
bzr commit into mysql-trunk branch (bar:3351) Alexander Barkov18 Nov