Commit c5004e39 authored by Alexander Barkov's avatar Alexander Barkov

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

Fixed.
parent c1a65228
...@@ -188,3 +188,15 @@ DROP TABLE t1, t2; ...@@ -188,3 +188,15 @@ DROP TABLE t1, t2;
SELECT '' LIKE '1' ESCAPE COUNT(1); SELECT '' LIKE '1' ESCAPE COUNT(1);
ERROR HY000: Incorrect arguments to ESCAPE ERROR HY000: Incorrect arguments to ESCAPE
End of 5.1 tests 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; ...@@ -133,3 +133,13 @@ DROP TABLE t1, t2;
SELECT '' LIKE '1' ESCAPE COUNT(1); SELECT '' LIKE '1' ESCAPE COUNT(1);
--echo End of 5.1 tests --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) ...@@ -5020,7 +5020,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
turboBM_compute_bad_character_shifts(); turboBM_compute_bad_character_shifts();
DBUG_PRINT("info",("done")); 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; 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