mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-31032: UBSAN|downcast of address X which does not point to an
object of type 'Item_string' in sql/json_schema.cc Analysis: make_string_literal() returns pointer of type Item_basic_constant which is converted to pointer of type Item_string. Now, Item_string is base class of Item_basic_constant, so the error about downcasting. Fix: using constructor of Item_string type directly instead of downcasting would be more appropriate.
This commit is contained in:
@ -3543,5 +3543,25 @@ SELECT JSON_SCHEMA_VALID(@schema, '9007900000000001');
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '9007900000000060');
|
||||
SELECT JSON_SCHEMA_VALID(@schema, '9007900000000061');
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31032: UBSAN|downcast of address X which does not point to an object of type
|
||||
--echo # Item_string' in sql/json_schema.cc
|
||||
--echo #
|
||||
|
||||
SET @old_sql_mode= @@sql_mode;
|
||||
|
||||
SET @schema='{ "type":"object","patternProperties": { "^I_": {"type":"number"},"^S_" : {"type":"string"} } }';
|
||||
SET SESSION sql_mode='empty_string_is_null';
|
||||
SELECT JSON_SCHEMA_VALID (@schema,'{"key1":"val0","key2":0,"I_int":0,"S_":"abc","prop0":"str0"}');
|
||||
|
||||
SET @@sql_mode= @old_sql_mode;
|
||||
|
||||
SET @property_names='{ "PropertyNames":{ "pattern": "^I_" } }';
|
||||
SET GLOBAL sql_mode=17179869183;
|
||||
SET @@sql_mode=DEFAULT;
|
||||
SELECT JSON_SCHEMA_VALID(@property_names, '{"I_int1":3, "I_ob1":{"key1":"val1"}}');
|
||||
|
||||
SET @@sql_mode= @old_sql_mode;
|
||||
set global sql_mode=default;
|
||||
|
||||
--echo # End of 11.1 test
|
||||
|
Reference in New Issue
Block a user