List:Commits« Previous MessageNext Message »
From:kgeorge Date:March 9 2007 11:05am
Subject:bk commit into 5.0 tree (gkodinov:1.2470)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-03-09 13:05:41+02:00, gkodinov@stripped +3 -0
  Merge gkodinov@stripped:/home/bk/mysql-5.0-opt
  into  magare.gmz:/home/kgeorge/mysql/autopush/B26281-5.0-opt
  MERGE: 1.2413.32.1

  mysql-test/r/func_str.result@stripped, 2007-03-09 13:05:40+02:00, gkodinov@stripped +12 -12
    resolved test merge conflicts 
    MERGE: 1.126.1.2

  mysql-test/t/func_str.test@stripped, 2007-03-09 13:05:40+02:00, gkodinov@stripped +8 -9
    resolved test merge conflicts 
    MERGE: 1.99.1.2

  sql/item_strfunc.cc@stripped, 2007-03-09 13:03:01+02:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.295.1.1

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gkodinov
# Host:	magare.gmz
# Root:	/home/kgeorge/mysql/autopush/B26281-5.0-opt/RESYNC

--- 1.296/sql/item_strfunc.cc	2007-03-01 18:59:52 +02:00
+++ 1.297/sql/item_strfunc.cc	2007-03-09 13:03:01 +02:00
@@ -967,18 +967,18 @@ String *Item_func_insert::val_str(String
       args[3]->null_value)
     goto null; /* purecov: inspected */
 
-  if ((start < 0) || (start > res->length() + 1))
+  if ((start < 0) || (start > res->length()))
     return res;                                 // Wrong param; skip insert
-  if ((length < 0) || (length > res->length() + 1))
-    length= res->length() + 1;
+  if ((length < 0) || (length > res->length()))
+    length= res->length();
 
   /* start and length are now sufficiently valid to pass to charpos function */
   start= res->charpos((int) start);
   length= res->charpos((int) length, (uint32) start);
 
   /* Re-testing with corrected params */
-  if (start > res->length() + 1)
-    return res;                                 // Wrong param; skip insert
+  if (start > res->length())
+    return res; /* purecov: inspected */        // Wrong param; skip insert
   if (length > res->length() - start)
     length= res->length() - start;
 

--- 1.128/mysql-test/r/func_str.result	2007-03-08 19:32:38 +02:00
+++ 1.129/mysql-test/r/func_str.result	2007-03-09 13:05:40 +02:00
@@ -1960,4 +1960,16 @@ NULL
 SELECT UNHEX('G') IS NULL;
 UNHEX('G') IS NULL
 1
+SELECT INSERT('abc', 3, 3, '1234');
+INSERT('abc', 3, 3, '1234')
+ab1234
+SELECT INSERT('abc', 4, 3, '1234');
+INSERT('abc', 4, 3, '1234')
+abc1234
+SELECT INSERT('abc', 5, 3, '1234');
+INSERT('abc', 5, 3, '1234')
+abc
+SELECT INSERT('abc', 6, 3, '1234');
+INSERT('abc', 6, 3, '1234')
+abc
 End of 5.0 tests

--- 1.101/mysql-test/t/func_str.test	2007-03-08 19:39:00 +02:00
+++ 1.102/mysql-test/t/func_str.test	2007-03-09 13:05:40 +02:00
@@ -1008,7 +1008,6 @@ select repeat('a', cast(2 as unsigned in
 select rpad('abc', cast(5 as unsigned integer), 'x');
 select lpad('abc', cast(5 as unsigned integer), 'x');
 
-
 #
 # Bug #25197 :repeat function returns null when using table field directly as count
 #
@@ -1035,5 +1034,13 @@ DROP TABLE t1;
 #
 SELECT UNHEX('G');
 SELECT UNHEX('G') IS NULL;
+
+#
+# Bug #26281: INSERT() function mishandles NUL on boundary condition
+#
+SELECT INSERT('abc', 3, 3, '1234');
+SELECT INSERT('abc', 4, 3, '1234');
+SELECT INSERT('abc', 5, 3, '1234');
+SELECT INSERT('abc', 6, 3, '1234');
 
 --echo End of 5.0 tests
Thread
bk commit into 5.0 tree (gkodinov:1.2470)kgeorge9 Mar