mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Bug#11766101 : 59140: LIKE CONCAT('%',@A,'%') DOESN'T MATCH WHEN @A CONTAINS LATIN1 STRING
Issue/Cause: Issue is of memory corruption.During optimization phase, pattern to be matched in where clause, is prepared. This is done in Item_func_concat::val_str() function which forms the resultant string (tmp_value) and return its pointer. In caller, Item_func_like::fix_fields, pattern is made to point to this string (tmp_value). In further processing, tmp_value is getting modified which causes pattern to have changed/wrong values. Fix: Allocate its own memroy location in caller, copy value of resultant string (tmp_value) into that and make pattern to point to that. This makes sure no further changes to tmp_value will affect pattern.
This commit is contained in:
parent
6053cb8cc1
commit
0581d1c46c
1 changed files with 1 additions and 1 deletions
|
@ -4877,8 +4877,8 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref)
|
|||
}
|
||||
if (canDoTurboBM)
|
||||
{
|
||||
pattern = first + 1;
|
||||
pattern_len = (int) len - 2;
|
||||
pattern = thd->strmake(first + 1, pattern_len);
|
||||
DBUG_PRINT("info", ("Initializing pattern: '%s'", first));
|
||||
int *suff = (int*) thd->alloc((int) (sizeof(int)*
|
||||
((pattern_len + 1)*2+
|
||||
|
|
Loading…
Reference in a new issue