|
20 | 20 | #include "item.h"
|
21 | 21 | #include "sql_parse.h" // For check_stack_overrun
|
22 | 22 |
|
23 |
| - |
24 | 23 | /*
|
25 | 24 | Compare ASCII string against the string with the specified
|
26 | 25 | character set.
|
@@ -136,9 +135,11 @@ int json_path_parts_compare(
|
136 | 135 | {
|
137 | 136 | int res, res2;
|
138 | 137 |
|
| 138 | + long arbitrary_var; |
| 139 | + long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); |
139 | 140 | DBUG_EXECUTE_IF("json_check_min_stack_requirement",
|
140 |
| - {alloca(my_thread_stack_size-(STACK_MIN_SIZE));}); |
141 |
| - if (check_stack_overrun(current_thd, STACK_MIN_SIZE, NULL)) |
| 141 | + {alloca(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); |
| 142 | + if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) |
142 | 143 | return 1;
|
143 | 144 | while (a <= a_end)
|
144 | 145 | {
|
@@ -1135,6 +1136,12 @@ static int check_contains(json_engine_t *js, json_engine_t *value)
|
1135 | 1136 | {
|
1136 | 1137 | json_engine_t loc_js;
|
1137 | 1138 | bool set_js;
|
| 1139 | + long arbitrary_var; |
| 1140 | + long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); |
| 1141 | + DBUG_EXECUTE_IF("json_check_min_stack_requirement", |
| 1142 | + {alloca(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); |
| 1143 | + if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) |
| 1144 | + return 1; |
1138 | 1145 |
|
1139 | 1146 | DBUG_EXECUTE_IF("json_check_min_stack_requirement",
|
1140 | 1147 | {alloca(my_thread_stack_size-(STACK_MIN_SIZE));});
|
@@ -2030,10 +2037,12 @@ String *Item_func_json_object::val_str(String *str)
|
2030 | 2037 | static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
|
2031 | 2038 | {
|
2032 | 2039 |
|
| 2040 | + long arbitrary_var; |
| 2041 | + long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); |
2033 | 2042 | DBUG_EXECUTE_IF("json_check_min_stack_requirement",
|
2034 |
| - {alloca(my_thread_stack_size-(STACK_MIN_SIZE));}); |
2035 |
| - if (check_stack_overrun(current_thd, STACK_MIN_SIZE, NULL)) |
2036 |
| - return 1; |
| 2043 | + {alloca(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); |
| 2044 | + if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) |
| 2045 | + return 1; |
2037 | 2046 |
|
2038 | 2047 | if (json_read_value(je1) || json_read_value(je2))
|
2039 | 2048 | return 1;
|
@@ -2367,9 +2376,11 @@ static int copy_value_patch(String *str, json_engine_t *je)
|
2367 | 2376 | static int do_merge_patch(String *str, json_engine_t *je1, json_engine_t *je2,
|
2368 | 2377 | bool *empty_result)
|
2369 | 2378 | {
|
| 2379 | + long arbitrary_var; |
| 2380 | + long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); |
2370 | 2381 | DBUG_EXECUTE_IF("json_check_min_stack_requirement",
|
2371 |
| - {alloca(my_thread_stack_size-(STACK_MIN_SIZE));}); |
2372 |
| - if (check_stack_overrun(current_thd, STACK_MIN_SIZE, NULL)) |
| 2382 | + {alloca(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); |
| 2383 | + if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) |
2373 | 2384 | return 1;
|
2374 | 2385 |
|
2375 | 2386 | if (json_read_value(je1) || json_read_value(je2))
|
|
0 commit comments