[MDEV-30690] Server crashed on function JSON_SCHEMA_VALID with incorrect input json schema Created: 2023-02-20  Updated: 2023-11-27  Resolved: 2023-04-13

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: None
Fix Version/s: 11.1.0

Type: Bug Priority: Critical
Reporter: Lena Startseva Assignee: Rucha Deodhar
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-27128 Implement JSON Schema Validation FUNC... Closed

 Description   

Cases like this causes server crash:

SET @schema = '{""}';
SELECT JSON_SCHEMA_VALID(@schema, '1');

Or it can be keyword in the schema without value:

SET @schema = '{  
  "type": "string",
  "format"
  }';
SELECT JSON_SCHEMA_VALID(@schema, '1');

Stack:

stack_bottom = 0x7f2cf075ac38 thread_stack 0x49000
mysys/stacktrace.c:212(my_print_stacktrace)[0x55a7edd7cca9]
sql/signal_handler.cc:236(handle_fatal_signal)[0x55a7ed43a293]
libc_sigaction.c:0(__restore_rt)[0x7f2cf5dc1520]
nptl/pthread_kill.c:44(__pthread_kill_implementation)[0x7f2cf5e15a7c]
posix/raise.c:27(__GI_raise)[0x7f2cf5dc1476]
stdlib/abort.c:81(__GI_abort)[0x7f2cf5da77f3]
intl/loadmsgcat.c:1177(_nl_load_domain)[0x7f2cf5da771b]
:0(__GI___assert_fail)[0x7f2cf5db8e96]
sql/protocol.cc:618(Protocol::end_statement())[0x55a7eceff57e]
sql/sql_parse.cc:2402(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55a7ed048bca]
sql/sql_parse.cc:1407(do_command(THD*, bool))[0x55a7ed0459cc]
sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x55a7ed23003f]
sql/sql_connect.cc:1320(handle_one_connection)[0x55a7ed22fda8]
perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55a7ed7b44ad]
nptl/pthread_create.c:442(start_thread)[0x7f2cf5e13b43]
x86_64/clone3.S:83(__clone3)[0x7f2cf5ea5a00]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f2ce00154c0): SELECT JSON_SCHEMA_VALID(@schema, '1')



 Comments   
Comment by Rucha Deodhar [ 2023-03-02 ]

patch:
https://github.com/MariaDB/server/tree/bb-MDEV-30690-json_schema

Comment by Alexey Botchkov [ 2023-04-08 ]

looks ok to push.

Generated at Thu Feb 08 10:18:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.