mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-11143 Server crashes in json_string_set_cs.
Some JSON functions didn't expect NULL as a path.
This commit is contained in:
@ -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());
|
||||
|
||||
|
Reference in New Issue
Block a user