diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2023-03-02 17:50:19 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2023-04-26 11:00:09 +0530 |
commit | d555f38af819db8b051c4f754358041f146e83f4 (patch) | |
tree | 19bebe98d78148ba30d6a914ce5577a4d096e0af /sql/json_schema.cc | |
parent | 1c25b5c02666420eba5708bb93a6a41e7d7a3a63 (diff) | |
download | mariadb-git-d555f38af819db8b051c4f754358041f146e83f4.tar.gz |
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.
Diffstat (limited to 'sql/json_schema.cc')
-rw-r--r-- | sql/json_schema.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sql/json_schema.cc b/sql/json_schema.cc index dcfae1d8205..a358ef735d0 100644 --- a/sql/json_schema.cc +++ b/sql/json_schema.cc @@ -392,7 +392,7 @@ bool Json_schema_type::handle_keyword(THD *thd, json_engine_t *je, return true; json_assign_type(&type, je); } - return false; + return je->s.error ? true : false; } else if (je->value_type == JSON_VALUE_STRING) { @@ -591,7 +591,7 @@ bool Json_schema_enum::handle_keyword(THD *thd, json_engine_t *je, } } } - return false; + return je->s.error ? true : false; } else { @@ -1595,7 +1595,7 @@ bool Json_schema_required::handle_keyword(THD *thd, json_engine_t *je, this->required_properties.push_back(str, thd->mem_root); } } - return false; + return je->s.error ? true : false; } bool Json_schema_dependent_required::validate(const json_engine_t *je, @@ -1758,7 +1758,7 @@ bool Json_schema_dependent_required::handle_keyword(THD *thd, json_engine_t *je, my_error(ER_JSON_INVALID_VALUE_FOR_KEYWORD, MYF(0), "dependentRequired"); return true; } - return false; + return je->s.error ? true : false; } bool Json_schema_property_names::validate(const json_engine_t *je, @@ -2120,7 +2120,7 @@ bool Json_schema_properties::handle_keyword(THD *thd, json_engine_t *je, } } } - return false; + return je->s.error ? true : false; } bool Json_schema_pattern_properties:: @@ -2806,7 +2806,7 @@ bool create_object_and_handle_keyword(THD *thd, json_engine_t *je, if (add_schema_interdependence(thd, &temporary_list, keyword_list)) return true; - return false; + return je->s.error ? true : false; } uchar* get_key_name_for_property(const char *key_name, size_t *length, |