Commit 85c15780 authored by Dmitry Shulga's avatar Dmitry Shulga

MDEV-32867: ASAN errors in Item_func_json_contains_path::val_int upon PS execution

This bug was caused by a patch for the task MDEV-32733.
Incorrect memory root was used for allocation of memory
pointed by the data memebr Item_func_json_contains_path::p_found.
parent ead61d9b
......@@ -79,4 +79,13 @@ DEALLOCATE PREPARE stmt;
DROP FUNCTION f1;
DROP VIEW v1;
DROP FUNCTION f2;
#
# MDEV-32867: ASAN errors in Item_func_json_contains_path::val_int upon PS execution
#
CREATE TABLE t1 (f BLOB) ENGINE=MyISAM;
PREPARE stmt FROM "SELECT * FROM t1 WHERE JSON_EXISTS(JSON_ARRAY('[true,1234567890]'), '$**.*') != JSON_CONTAINS_PATH(JSON_INSERT('{}', '$[1]', NULL), 'all', '$[1]')";
EXECUTE stmt;
f
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# End of 10.4 tests
......@@ -97,4 +97,16 @@ DROP FUNCTION f1;
DROP VIEW v1;
DROP FUNCTION f2;
--echo #
--echo # MDEV-32867: ASAN errors in Item_func_json_contains_path::val_int upon PS execution
--echo #
CREATE TABLE t1 (f BLOB) ENGINE=MyISAM;
PREPARE stmt FROM "SELECT * FROM t1 WHERE JSON_EXISTS(JSON_ARRAY('[true,1234567890]'), '$**.*') != JSON_CONTAINS_PATH(JSON_INSERT('{}', '$[1]', NULL), 'all', '$[1]')";
EXECUTE stmt;
# Clean up
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo # End of 10.4 tests
......@@ -1437,7 +1437,7 @@ bool Item_func_json_contains_path::fix_fields(THD *thd, Item **ref)
if (!tmp_paths)
{
if (alloc_tmp_paths(thd, arg_count-2, &paths, &tmp_paths) ||
(p_found= (bool *) alloc_root(thd->mem_root,
(p_found= (bool *) alloc_root(thd->active_stmt_arena_to_use()->mem_root,
(arg_count-2)*sizeof(bool))) == NULL)
return true;
}
......
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