Commit 955f4258 authored by Bjorn Munch's avatar Bjorn Munch

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

Add check that there is a RHS of the expression
Added to mysqltest.test
parent 57f7b9f4
......@@ -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]))
......
......@@ -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
......
......@@ -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
# ----------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment