diff options
author | Neeraj Bisht <neeraj.x.bisht@oracle.com> | 2013-01-14 16:51:52 +0530 |
---|---|---|
committer | Neeraj Bisht <neeraj.x.bisht@oracle.com> | 2013-01-14 16:51:52 +0530 |
commit | 84d798a1d533fb20cdb90dc0bcfae0891873f1bf (patch) | |
tree | 59d42a3d31a24a34b677d3383a42f33feb39b9f5 /strings/ctype-uca.c | |
parent | fd5380b4964df7e0202bd9b9ac77f6874018e185 (diff) | |
parent | 99645e5be59145bcab2fe36aefde4224e6e69961 (diff) | |
download | mariadb-git-84d798a1d533fb20cdb90dc0bcfae0891873f1bf.tar.gz |
BUG#14303860 - EXECUTING A SELECT QUERY WITH TOO
MANY WILDCARDS CAUSES A SEGFAULT
Back port from 5.6 and trunk
Diffstat (limited to 'strings/ctype-uca.c')
-rw-r--r-- | strings/ctype-uca.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index a52f9e304e9..1dabdcae442 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -7394,10 +7394,10 @@ static int my_uca_charcmp(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2) */ static -int my_wildcmp_uca(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 my_wildcmp_uca_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 */ my_wc_t s_wc, w_wc; @@ -7405,7 +7405,9 @@ int my_wildcmp_uca(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) @@ -7512,8 +7514,8 @@ int my_wildcmp_uca(CHARSET_INFO *cs, if (str == str_end) return -1; - result= my_wildcmp_uca(cs, str, str_end, wildstr, wildend, - escape, w_one, w_many); + result= my_wildcmp_uca_impl(cs, str, str_end, wildstr, wildend, + escape, w_one, w_many, recurse_level+1); if (result <= 0) return result; @@ -7525,6 +7527,16 @@ int my_wildcmp_uca(CHARSET_INFO *cs, return (str != str_end ? 1 : 0); } +int my_wildcmp_uca(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_uca_impl(cs, str, str_end, + wildstr, wildend, + escape, w_one, w_many, 1); +} + /* Collation language is implemented according to |