Bug #58695 mysqltest coredumps on "if($x == ){"

Add check that there is a RHS of the expression
Added to mysqltest.test
This commit is contained in:
Bjorn Munch 2010-12-09 12:15:25 +01:00
parent 81d29b1d82
commit 06790ea7be
3 changed files with 9 additions and 0 deletions

View file

@ -5680,6 +5680,8 @@ void do_block(enum block_cmd cmd, struct st_command* command)
}
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]))

View file

@ -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

View file

@ -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
# ----------------------------------------------------------------------------