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 14:59:48 +05:30
commit 99645e5be5
10 changed files with 145 additions and 47 deletions

View file

@ -1889,11 +1889,12 @@ MY_UNICASE_INFO *my_unicase_turkish[256]=
** 1 if matched with wildcard
*/
int my_wildcmp_unicode(CHARSET_INFO *cs,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many,
MY_UNICASE_INFO **weights)
static
int my_wildcmp_unicode_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,
MY_UNICASE_INFO **weights, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
my_wc_t s_wc, w_wc;
@ -1901,7 +1902,9 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
int (*mb_wc)(struct charset_info_st *, my_wc_t *,
const uchar *, const uchar *);
mb_wc= cs->cset->mb_wc;
if (my_string_stack_guard && my_string_stack_guard(recurse_level))
return 1;
while (wildstr != wildend)
{
while (1)
@ -2027,9 +2030,9 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
return -1;
str+= scan;
result= my_wildcmp_unicode(cs, str, str_end, wildstr, wildend,
escape, w_one, w_many,
weights);
result= my_wildcmp_unicode_impl(cs, str, str_end, wildstr, wildend,
escape, w_one, w_many,
weights, recurse_level+1);
if (result <= 0)
return result;
}
@ -2038,6 +2041,18 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
return (str != str_end ? 1 : 0);
}
int
my_wildcmp_unicode(CHARSET_INFO *cs,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many,
MY_UNICASE_INFO **weights)
{
return my_wildcmp_unicode_impl(cs, str, str_end,
wildstr, wildend,
escape, w_one, w_many, weights, 1);
}
#endif