summaryrefslogtreecommitdiff
path: root/sql/item_jsonfunc.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-08-09 09:52:15 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-08-09 09:52:15 +0200
commit75d631f333544de4487a6dd251d6f361e1d55d6b (patch)
tree4e234afa19a458b9b0727859c53c290c683a502d /sql/item_jsonfunc.cc
parent9cbf8ccf2990f9db8d9debee42bc9213cbb04457 (diff)
parent1d480419822b53c840de54542c1d1a0851dbe2c8 (diff)
downloadmariadb-git-75d631f333544de4487a6dd251d6f361e1d55d6b.tar.gz
Merge branch '10.7' into 10.8
Diffstat (limited to 'sql/item_jsonfunc.cc')
-rw-r--r--sql/item_jsonfunc.cc42
1 files changed, 26 insertions, 16 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 725fe4ab33e..b36f9d1ccb4 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -150,10 +150,12 @@ int json_path_parts_compare(
{
int res, res2;
- long 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);});
+ {
+ long arbitrary_var;
+ long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var));
+ ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);
+ });
if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
return 1;
@@ -1166,13 +1168,15 @@ my_decimal *Item_func_json_extract::val_decimal(my_decimal *to)
case JSON_VALUE_OBJECT:
case JSON_VALUE_ARRAY:
case JSON_VALUE_FALSE:
- case JSON_VALUE_NULL:
case JSON_VALUE_UNINITIALIZED:
- break;
+ // TODO: fix: NULL should be NULL
+ case JSON_VALUE_NULL:
+ int2my_decimal(E_DEC_FATAL_ERROR, 0, false/*unsigned_flag*/, to);
+ return to;
};
}
- int2my_decimal(E_DEC_FATAL_ERROR, 0, false/*unsigned_flag*/, to);
- return to;
+ DBUG_ASSERT(null_value);
+ return 0;
}
@@ -1210,10 +1214,12 @@ static int check_contains(json_engine_t *js, json_engine_t *value)
{
json_engine_t loc_js;
bool set_js;
- long 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);});
+ {
+ long arbitrary_var;
+ long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var));
+ ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);
+ });
if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
return 1;
@@ -2180,10 +2186,12 @@ err_return:
static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
{
- long 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);});
+ {
+ long arbitrary_var;
+ long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var));
+ ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);
+ });
if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
return 1;
@@ -2521,10 +2529,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,
bool *empty_result)
{
- long 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);});
+ {
+ long arbitrary_var;
+ long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var));
+ ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);
+ });
if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
return 1;