summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-05-11 19:48:42 +0200
committerSergei Golubchik <serg@mariadb.org>2017-05-15 22:23:10 +0200
commit52aa200919b1fd9357c05bcdfc66a42e51f242b3 (patch)
tree7c3c15b54110084a64e6f5f07e70de3016b1b6ae /sql/item_cmpfunc.cc
parent602b5e4c498ad2e2d045adfa4fd1478ac437582a (diff)
downloadmariadb-git-52aa200919b1fd9357c05bcdfc66a42e51f242b3.tar.gz
MDEV-12420 max_recursive_iterations did not prevent a stack-overflow and segfault
post-review fixes * move pcre-specific variable out of mysys * don't use current_thd * move a commonly used macro to my_sys.h * remove new sysvar
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index bfad63f21f8..038a0ebabc2 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -5104,6 +5104,15 @@ int Regexp_processor_pcre::default_regex_flags()
return default_regex_flags_pcre(current_thd);
}
+void Regexp_processor_pcre::set_recursion_limit(THD *thd)
+{
+ long stack_used;
+ DBUG_ASSERT(thd == current_thd);
+ stack_used= available_stack_size(thd->thread_stack, &stack_used);
+ m_pcre_extra.match_limit_recursion=
+ (my_thread_stack_size - stack_used)/my_pcre_frame_size;
+}
+
/**
Convert string to lib_charset, if needed.