Commit 25219920 authored by Rucha Deodhar's avatar Rucha Deodhar

MDEV-28762: recursive call of some json functions without stack control

Fixup to MDEV-28762. Fixes warnings about unused variable "stack_used_up"
during building with RelWithDebInfo
parent f9315b33
...@@ -150,10 +150,12 @@ int json_path_parts_compare( ...@@ -150,10 +150,12 @@ int json_path_parts_compare(
{ {
int res, res2; int res, res2;
DBUG_EXECUTE_IF("json_check_min_stack_requirement",
{
long arbitrary_var; long arbitrary_var;
long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var));
DBUG_EXECUTE_IF("json_check_min_stack_requirement", ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);
{ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); });
if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
return 1; return 1;
...@@ -1154,10 +1156,12 @@ static int check_contains(json_engine_t *js, json_engine_t *value) ...@@ -1154,10 +1156,12 @@ static int check_contains(json_engine_t *js, json_engine_t *value)
{ {
json_engine_t loc_js; json_engine_t loc_js;
bool set_js; bool set_js;
DBUG_EXECUTE_IF("json_check_min_stack_requirement",
{
long arbitrary_var; long arbitrary_var;
long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var));
DBUG_EXECUTE_IF("json_check_min_stack_requirement", ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);
{ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); });
if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
return 1; return 1;
...@@ -2050,10 +2054,12 @@ String *Item_func_json_object::val_str(String *str) ...@@ -2050,10 +2054,12 @@ String *Item_func_json_object::val_str(String *str)
static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2) static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
{ {
DBUG_EXECUTE_IF("json_check_min_stack_requirement",
{
long arbitrary_var; long arbitrary_var;
long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var));
DBUG_EXECUTE_IF("json_check_min_stack_requirement", ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);
{ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); });
if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
return 1; return 1;
...@@ -2389,10 +2395,12 @@ static int copy_value_patch(String *str, json_engine_t *je) ...@@ -2389,10 +2395,12 @@ static int copy_value_patch(String *str, json_engine_t *je)
static int do_merge_patch(String *str, json_engine_t *je1, json_engine_t *je2, static int do_merge_patch(String *str, json_engine_t *je1, json_engine_t *je2,
bool *empty_result) bool *empty_result)
{ {
DBUG_EXECUTE_IF("json_check_min_stack_requirement",
{
long arbitrary_var; long arbitrary_var;
long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var));
DBUG_EXECUTE_IF("json_check_min_stack_requirement", ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);
{ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); });
if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment