Commit 07445510 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-5445 Server crashes in Item_func_like::fix_fields on LIKE ExtractValue(..)

backporting from the main 10.0

modified:
  mysql-test/r/func_like.result
  mysql-test/t/func_like.test
  sql/item_cmpfunc.cc
parent 6bf10fac
......@@ -188,3 +188,15 @@ DROP TABLE t1, t2;
SELECT '' LIKE '1' ESCAPE COUNT(1);
ERROR HY000: Incorrect arguments to ESCAPE
End of 5.1 tests
#
# Start of 10.0 tests
#
#
# MDEV-5445 Server crashes in Item_func_like::fix_fields on LIKE ExtractValue(..)
#
SELECT 'a' LIKE REPEAT('',0);
'a' LIKE REPEAT('',0)
0
SELECT 'a' LIKE EXTRACTVALUE('bar','qux');
'a' LIKE EXTRACTVALUE('bar','qux')
0
......@@ -133,3 +133,13 @@ DROP TABLE t1, t2;
SELECT '' LIKE '1' ESCAPE COUNT(1);
--echo End of 5.1 tests
--echo #
--echo # Start of 10.0 tests
--echo #
--echo #
--echo # MDEV-5445 Server crashes in Item_func_like::fix_fields on LIKE ExtractValue(..)
--echo #
SELECT 'a' LIKE REPEAT('',0);
SELECT 'a' LIKE EXTRACTVALUE('bar','qux');
......@@ -5020,7 +5020,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
turboBM_compute_bad_character_shifts();
DBUG_PRINT("info",("done"));
}
use_sampling= ((*first == wild_many || *first == wild_one) && len > 2);
use_sampling= (len > 2 && (*first == wild_many || *first == wild_one));
}
}
return FALSE;
......
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