1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-30690: Server crashed on function JSON_SCHEMA_VALID with incorrect

input json schema

Analysis: In case of syntax error while scanning json schema, true is
returned inspite of it being wanring and not error.
Fix: return true instead of false.
This commit is contained in:
Rucha Deodhar
2023-03-02 17:50:19 +05:30
parent 1c25b5c026
commit d555f38af8
4 changed files with 81 additions and 11 deletions

View File

@ -3449,4 +3449,29 @@ SELECT JSON_SCHEMA_VALID(@schema_pattern_properties, '{"I_": 150}');
SELECT JSON_SCHEMA_VALID(@schema_pattern_properties, '{"i_": 50}');
SELECT JSON_SCHEMA_VALID(@schema_pattern_properties, '{"i_": 150}');
--echo #
--echo # MDEV-30690: Server crashed on function JSON_SCHEMA_VALID with incorrect input json schema
--echo #
SET @schema = '{""}';
SELECT JSON_SCHEMA_VALID(@schema, '1');
SET @schema = '{
"type": "string",
"format"
}';
SELECT JSON_SCHEMA_VALID(@schema, '1');
SET @invalid_schema= '{"type":"object"
"properties":{
"number1": {"type":"number"},
"obj2": {"type":"object",
"properties": {
"key1": {"type":"number"}
}
}
}
}';
SELECT JSON_SCHEMA_VALID(@invalid_schema, '{"number1":3, "obj2":{"key1":3}}');
--echo # End of 11.1 test