List:Commits« Previous MessageNext Message »
From:msvensson Date:September 7 2006 10:42am
Subject:bk commit into 5.0 tree (msvensson:1.2255) BUG#20894
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson 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, 2006-09-07 10:42:17+02:00, msvensson@neptunus.(none) +3 -0
  Bug#20894 Reproducible MySQL client segmentation fault
   - Add to null bytes in to buff allowing us to call get_arg two times also for strings
longer than sizeof(buff) 

  client/mysql.cc@stripped, 2006-09-07 10:42:14+02:00, msvensson@neptunus.(none) +5 -1
    Make sure there are _two_ zero bytes at the end of buff, to allow 'get_arg' to be
called twice on long strings. The first
    time it will mark end of string with a zero and the second time it will "skip ahead"
to the first zero, and the find the
    second one indicating end of buff.

  mysql-test/r/mysql.result@stripped, 2006-09-07 10:42:14+02:00, msvensson@neptunus.(none) +18
-0
    Update test results

  mysql-test/t/mysql.test@stripped, 2006-09-07 10:42:14+02:00, msvensson@neptunus.(none) +48
-2
    Add tests for "com_connect" function in mysql
    Add test reported in bug

# 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:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug20894/my50-bug20894

--- 1.216/client/mysql.cc	2006-09-07 10:42:22 +02:00
+++ 1.217/client/mysql.cc	2006-09-07 10:42:22 +02:00
@@ -2909,7 +2909,11 @@ com_connect(String *buffer, char *line)
   bzero(buff, sizeof(buff));
   if (buffer)
   {
-    strmake(buff, line, sizeof(buff));
+    /*
+      Two null bytes are needed in the end of buff to allow
+      get_arg to find end of string the second time it's called.
+    */
+    strmake(buff, line, sizeof(buff)-2);
     tmp= get_arg(buff, 0);
     if (tmp && *tmp)
     {

--- 1.15/mysql-test/r/mysql.result	2006-09-07 10:42:22 +02:00
+++ 1.16/mysql-test/r/mysql.result	2006-09-07 10:42:22 +02:00
@@ -114,6 +114,7 @@ a	int(11)	YES		NULL	
 b	varchar(255)	YES		NULL	
 c	int(11)	YES		NULL	
 drop table t1;
+ERROR 1049 (42000) at line 1: Unknown database
'verylongdatabasenamethatshouldblowthe256byteslongbufferincom_con'
 1
 1
 ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at line 1
@@ -122,4 +123,21 @@ ERROR at line 1: USE must be followed by
 \\
 ';
 ';
+Test connect without db- or host-name => reconnect
+Test connect with dbname only => new dbname, old hostname
+ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'connecttest' at
line 1
+Test connect with _invalid_ dbname only => new invalid dbname, old hostname
+ERROR 1049 (42000) at line 1: Unknown database 'invalid'
+ERROR 1049 (42000) at line 1: Unknown database 'invalid'
+Test connect with dbname + hostname
+Test connect with dbname + _invalid_ hostname
+ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'invalid_hostname' (1)
+ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'invalid_hostname' (1)
+The commands reported in the bug report
+ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'cyril has found a bug
:)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' (3)
+ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'cyril has found a bug
:)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' (3)
+Too long dbname
+ERROR 1049 (42000) at line 1: Unknown database
'test_really_long_dbnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
+Too long hostname
+ERROR 2005 (HY000) at line 1: Unknown MySQL server host
'cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
(3)
 End of 5.0 tests

--- 1.15/mysql-test/t/mysql.test	2006-09-07 10:42:22 +02:00
+++ 1.16/mysql-test/t/mysql.test	2006-09-07 10:42:22 +02:00
@@ -86,13 +86,11 @@ create table t1(a int, b varchar(255), c
 --exec $MYSQL test -e "desc t1\g"
 drop table t1;
 
---disable_parsing
 #
 # Bug#21042  	mysql client segfaults on importing a mysqldump export
 #
 --error 1
 --exec $MYSQL test -e "connect
verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend"
2>&1
---enable_parsing
 
 
 #
@@ -139,5 +137,53 @@ drop table t1;
 --exec echo "SET SQL_MODE = '';"  > $MYSQLTEST_VARDIR/tmp/bug20103.sql
 --exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
 --exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
+
+#
+# Bug#20984: Reproducible MySQL client segmentation fault
+#  + additional tests for the "com_connect" function in mysql
+#
+#
+--echo Test connect without db- or host-name => reconnect
+--exec $MYSQL test -e "\r" 2>&1
+--exec $MYSQL test -e "connect" 2>&1
+
+--echo Test connect with dbname only => new dbname, old hostname
+--exec $MYSQL test -e "\r test" 2>&1
+--exec $MYSQL test -e "connect test" 2>&1
+--exec $MYSQL test -e "\rtest" 2>&1
+--error 1
+--exec $MYSQL test -e "connecttest" 2>&1
+
+--echo Test connect with _invalid_ dbname only => new invalid dbname, old hostname
+--error 1
+--exec $MYSQL test -e "\r invalid" 2>&1
+--error 1
+--exec $MYSQL test -e "connect invalid" 2>&1
+
+--echo Test connect with dbname + hostname
+--exec $MYSQL test -e "\r test localhost" 2>&1
+--exec $MYSQL test -e "connect test localhost" 2>&1
+
+--echo Test connect with dbname + _invalid_ hostname
+--error 1
+--exec $MYSQL test -e "\r test invalid_hostname" 2>&1
+--error 1
+--exec $MYSQL test -e "connect test invalid_hostname" 2>&1
+
+--echo The commands reported in the bug report
+--error 1
+--exec $MYSQL test -e "\r\r\n\r\n cyril\ has\ found\ a\ bug\
:)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
2>&1
+
+--error 1
+--exec echo '\r\r\n\r\n cyril\ has\ found\ a\ bug\
:)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
| $MYSQL 2>&1
+
+--echo Too long dbname
+--error 1
+--exec echo '\r
test_really_long_dbnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
localhost' | $MYSQL 2>&1
+
+--echo Too long hostname
+--error 1
+--exec echo '\r  test
cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
| $MYSQL 2>&1
+
 
 --echo End of 5.0 tests
Thread
bk commit into 5.0 tree (msvensson:1.2255) BUG#20894msvensson7 Sep