1
0
mirror of https://github.com/MariaDB/server.git synced 2025-04-18 21:44:20 +03:00

MDEV-21530: json_extract STILL crashes in Item_func_json_extract::read_json

Analysis:
Wrong comparison function is used, resulting in wrong argument to the
read_json() function.
Fix:
Used correct function.
This commit is contained in:
Rucha Deodhar 2025-04-16 18:22:05 +05:30
parent 5f2562291c
commit ac401a368d
3 changed files with 17 additions and 1 deletions

View File

@ -1766,5 +1766,13 @@ FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t;
data
<root language="de"></root>
#
# MDEV-21530: json_extract STILL crashes in Item_func_json_extract::read_json
#
select null<=>json_extract('1',json_object(null,'{ }',null,null),'{}');
null<=>json_extract('1',json_object(null,'{ }',null,null),'{}')
1
Warnings:
Warning 4042 Syntax error in JSON path in argument 2 to function 'json_extract' at position 1
#
# End of 10.6 tests
#

View File

@ -1231,6 +1231,14 @@ SELECT
data
FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t;
--echo #
--echo # MDEV-21530: json_extract STILL crashes in Item_func_json_extract::read_json
--echo #
select null<=>json_extract('1',json_object(null,'{ }',null,null),'{}');
--echo #
--echo # End of 10.6 tests
--echo #

View File

@ -603,7 +603,7 @@ bool Arg_comparator::set_cmp_func_string(THD *thd)
else if ((*b)->type() == Item::FUNC_ITEM &&
((Item_func *) (*b))->functype() == Item_func::JSON_EXTRACT_FUNC)
{
func= is_owner_equal_func() ? &Arg_comparator::compare_e_json_str:
func= is_owner_equal_func() ? &Arg_comparator::compare_e_str_json:
&Arg_comparator::compare_str_json;
return 0;
}