#At file:///home/bm136801/my/ifcore-55/ based on revid:bjorn.munch@stripped
3123 Bjorn Munch 2010-12-06
Bug #58695 mysqltest coredumps on "if($x == ){"
Add check that there is a RHS of the expression
Added to mysqltest.test
modified:
client/mysqltest.cc
mysql-test/r/mysqltest.result
mysql-test/t/mysqltest.test
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc 2010-11-26 09:57:01 +0000
+++ b/client/mysqltest.cc 2010-12-06 15:11:12 +0000
@@ -5677,6 +5677,8 @@ void do_block(enum block_cmd cmd, struct
}
while (my_isspace(charset_info, *curr_ptr))
curr_ptr++;
+ if (curr_ptr == expr_end)
+ die("Missing right operand in comparison");
/* Strip off trailing white space */
while (my_isspace(charset_info, expr_end[-1]))
=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result 2010-11-26 09:57:01 +0000
+++ b/mysql-test/r/mysqltest.result 2010-12-06 15:11:12 +0000
@@ -434,6 +434,8 @@ anything goes
mysqltest: At line 2: Only == and != are supported for string values
mysqltest: At line 2: Found junk '~= 6' after $variable in condition
mysqltest: At line 2: Expression in if/while must beging with $, ` or a number
+mysqltest: At line 1: Missing right operand in comparison
+mysqltest: At line 1: Missing right operand in comparison
counter is 2
counter is 3
counter is 4
=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test 2010-11-26 09:57:01 +0000
+++ b/mysql-test/t/mysqltest.test 2010-12-06 15:11:12 +0000
@@ -1354,6 +1354,11 @@ EOF
--exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1
remove_file $MYSQL_TMP_DIR/mysqltest.sql;
+--error 1
+--exec echo "if (\$var ==) {" | $MYSQL_TEST 2>&1
+--error 1
+--exec echo "if (\$var > ) {" | $MYSQL_TEST 2>&1
+
# ----------------------------------------------------------------------------
# Test while with compare conditions
# ----------------------------------------------------------------------------
Attachment: [text/bzr-bundle] bzr/bjorn.munch@oracle.com-20101206151112-azfd6ptxx2fpotg0.bundle
| Thread |
|---|
| • bzr commit into mysql-5.5-mtr branch (bjorn.munch:3123) Bug#58695 | Bjorn Munch | 6 Dec |