mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
BUG#14303860 - EXECUTING A SELECT QUERY WITH TOO
MANY WILDCARDS CAUSES A SEGFAULT Back port from 5.6 and trunk
This commit is contained in:
@ -841,13 +841,16 @@ cnv:
|
||||
#define INC_PTR(cs,A,B) (A)++
|
||||
|
||||
|
||||
int my_wildcmp_8bit(CHARSET_INFO *cs,
|
||||
const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,
|
||||
int escape, int w_one, int w_many)
|
||||
static
|
||||
int my_wildcmp_8bit_impl(CHARSET_INFO *cs,
|
||||
const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,
|
||||
int escape, int w_one, int w_many, int recurse_level)
|
||||
{
|
||||
int result= -1; /* Not found, using wildcards */
|
||||
|
||||
if (my_string_stack_guard && my_string_stack_guard(recurse_level))
|
||||
return 1;
|
||||
while (wildstr != wildend)
|
||||
{
|
||||
while (*wildstr != w_many && *wildstr != w_one)
|
||||
@ -907,8 +910,9 @@ int my_wildcmp_8bit(CHARSET_INFO *cs,
|
||||
str++;
|
||||
if (str++ == str_end) return(-1);
|
||||
{
|
||||
int tmp=my_wildcmp_8bit(cs,str,str_end,wildstr,wildend,escape,w_one,
|
||||
w_many);
|
||||
int tmp=my_wildcmp_8bit_impl(cs,str,str_end,
|
||||
wildstr,wildend,escape,w_one,
|
||||
w_many, recurse_level+1);
|
||||
if (tmp <= 0)
|
||||
return(tmp);
|
||||
}
|
||||
@ -919,6 +923,16 @@ int my_wildcmp_8bit(CHARSET_INFO *cs,
|
||||
return(str != str_end ? 1 : 0);
|
||||
}
|
||||
|
||||
int my_wildcmp_8bit(CHARSET_INFO *cs,
|
||||
const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,
|
||||
int escape, int w_one, int w_many)
|
||||
{
|
||||
return my_wildcmp_8bit_impl(cs, str, str_end,
|
||||
wildstr, wildend,
|
||||
escape, w_one, w_many, 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Calculate min_str and max_str that ranges a LIKE string.
|
||||
|
Reference in New Issue
Block a user