Commit 4ad0813a authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-11143 Server crashes in json_string_set_cs.

        Some JSON functions didn't expect NULL as a path.
parent e8c41957
......@@ -91,6 +91,9 @@ json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2")
select json_contains_path('{ "a": true }', NULL, '$.a' );
json_contains_path('{ "a": true }', NULL, '$.a' )
NULL
select json_contains_path('{ "a": true }', 'all', NULL );
json_contains_path('{ "a": true }', 'all', NULL )
NULL
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1")
"asd"
......
......@@ -36,6 +36,7 @@ select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma");
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma");
select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2");
select json_contains_path('{ "a": true }', NULL, '$.a' );
select json_contains_path('{ "a": true }', 'all', NULL );
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY");
......
......@@ -450,6 +450,9 @@ String *Item_func_json_extract::val_str(String *str)
c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
goto error;
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
......@@ -547,6 +550,9 @@ longlong Item_func_json_extract::val_int()
c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
goto error;
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
......@@ -661,6 +667,9 @@ longlong Item_func_json_contains::val_int()
c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
goto error;
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
......@@ -768,6 +777,9 @@ longlong Item_func_json_contains_path::val_int()
c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
goto error;
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
......@@ -1946,6 +1958,9 @@ String *Item_func_json_search::val_str(String *str)
}
}
if (args[n_arg]->null_value)
goto null_return;
json_scan_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length());
......
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