1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +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:
Neeraj Bisht
2013-01-14 16:51:52 +05:30
10 changed files with 144 additions and 49 deletions

View File

@ -318,13 +318,16 @@ void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)),
#define INC_PTR(cs,A,B) (A)++
int my_wildcmp_bin(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_bin_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)
@ -383,8 +386,8 @@ int my_wildcmp_bin(CHARSET_INFO *cs,
if (str++ == str_end)
return(-1);
{
int tmp=my_wildcmp_bin(cs,str,str_end,wildstr,wildend,escape,w_one,
w_many);
int tmp=my_wildcmp_bin_impl(cs,str,str_end,wildstr,wildend,escape,w_one,
w_many, recurse_level + 1);
if (tmp <= 0)
return(tmp);
}
@ -395,6 +398,16 @@ int my_wildcmp_bin(CHARSET_INFO *cs,
return(str != str_end ? 1 : 0);
}
int my_wildcmp_bin(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_bin_impl(cs, str, str_end,
wildstr, wildend,
escape, w_one, w_many, 1);
}
static size_t my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
uchar *dest, size_t dstlen,