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"}');
|
Leads to
11.1.0 83a4449ab98b5b6f08e18833bf9dd3e61e96c680 (Debug, UBASAN)
|
/test/JSON/11.1_dbg_san/sql/json_schema.cc:2200:86: runtime error: downcast of address 0x6290000d9128 which does not point to an object of type 'Item_string'
|
0x6290000d9128: note: object is of type 'Item_null'
|
00 00 00 00 88 ad 93 07 50 56 00 00 00 00 00 00 00 00 00 00 20 be bb 0f 50 56 00 00 06 00 00 00
|
^~~~~~~~~~~~~~~~~~~~~~~
|
vptr for 'Item_null'
|
#0 0x56500309d6a7 in Json_schema_pattern_properties::handle_keyword(THD*, st_json_engine_t*, char const*, char const*, List<Json_schema_keyword>*) /test/JSON/11.1_dbg_san/sql/json_schema.cc:2200
|
#1 0x56500309ac6b in create_object_and_handle_keyword(THD*, st_json_engine_t*, List<Json_schema_keyword>*, List<Json_schema_keyword>*) /test/JSON/11.1_dbg_san/sql/json_schema.cc:2759
|
Setup
Compiled with GCC 9.4.0
|
-DWITH_UBSAN=ON -DCMAKE_CXX_FLAGS=-static-libasan
|
- is caused by
-
MDEV-27128
Implement JSON Schema Validation FUNCTION
-
-
Closed
{"report":{"fcp":1274,"ttfb":386.5999994277954,"pageVisibility":"visible","entityId":120958,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"83cbe3b6-31db-4d6b-ab5d-f8b5ebd76a17","navigationType":0,"readyForUser":1358.0999994277954,"redirectCount":0,"resourceLoadedEnd":1570.8000001907349,"resourceLoadedStart":393.0999994277954,"resourceTiming":[{"duration":411.9000005722046,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":393.0999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":393.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":805,"responseStart":0,"secureConnectionStart":0},{"duration":411.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":393.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":393.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":805.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":420.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":393.69999980926514,"connectEnd":393.69999980926514,"connectStart":393.69999980926514,"domainLookupEnd":393.69999980926514,"domainLookupStart":393.69999980926514,"fetchStart":393.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":393.69999980926514,"responseEnd":814.3000001907349,"responseStart":814.3000001907349,"secureConnectionStart":393.69999980926514},{"duration":477.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":393.8999996185303,"connectEnd":393.8999996185303,"connectStart":393.8999996185303,"domainLookupEnd":393.8999996185303,"domainLookupStart":393.8999996185303,"fetchStart":393.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":393.8999996185303,"responseEnd":871.5,"responseStart":871.5,"secureConnectionStart":393.8999996185303},{"duration":481.20000076293945,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":394.0999994277954,"connectEnd":394.0999994277954,"connectStart":394.0999994277954,"domainLookupEnd":394.0999994277954,"domainLookupStart":394.0999994277954,"fetchStart":394.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":394.0999994277954,"responseEnd":875.3000001907349,"responseStart":875.3000001907349,"secureConnectionStart":394.0999994277954},{"duration":481.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":394.30000019073486,"connectEnd":394.30000019073486,"connectStart":394.30000019073486,"domainLookupEnd":394.30000019073486,"domainLookupStart":394.30000019073486,"fetchStart":394.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":394.30000019073486,"responseEnd":875.8000001907349,"responseStart":875.8000001907349,"secureConnectionStart":394.30000019073486},{"duration":482.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":394.3999996185303,"connectEnd":394.3999996185303,"connectStart":394.3999996185303,"domainLookupEnd":394.3999996185303,"domainLookupStart":394.3999996185303,"fetchStart":394.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":394.3999996185303,"responseEnd":877,"responseStart":877,"secureConnectionStart":394.3999996185303},{"duration":563.1000003814697,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":394.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":394.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":957.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":483.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":394.8999996185303,"connectEnd":394.8999996185303,"connectStart":394.8999996185303,"domainLookupEnd":394.8999996185303,"domainLookupStart":394.8999996185303,"fetchStart":394.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":394.8999996185303,"responseEnd":878.0999994277954,"responseStart":878.0999994277954,"secureConnectionStart":394.8999996185303},{"duration":562.8000001907349,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":395.0999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":395.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":957.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":484.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":395.19999980926514,"connectEnd":395.19999980926514,"connectStart":395.19999980926514,"domainLookupEnd":395.19999980926514,"domainLookupStart":395.19999980926514,"fetchStart":395.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":395.19999980926514,"responseEnd":879.3000001907349,"responseStart":879.3000001907349,"secureConnectionStart":395.19999980926514},{"duration":866,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":396.19999980926514,"connectEnd":396.19999980926514,"connectStart":396.19999980926514,"domainLookupEnd":396.19999980926514,"domainLookupStart":396.19999980926514,"fetchStart":396.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":396.19999980926514,"responseEnd":1262.1999998092651,"responseStart":1262.0999994277954,"secureConnectionStart":396.19999980926514},{"duration":1170.2000007629395,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":400.5999994277954,"connectEnd":400.5999994277954,"connectStart":400.5999994277954,"domainLookupEnd":400.5999994277954,"domainLookupStart":400.5999994277954,"fetchStart":400.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":400.5999994277954,"responseEnd":1570.8000001907349,"responseStart":1570.8000001907349,"secureConnectionStart":400.5999994277954},{"duration":293.29999923706055,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":969.8000001907349,"connectEnd":969.8000001907349,"connectStart":969.8000001907349,"domainLookupEnd":969.8000001907349,"domainLookupStart":969.8000001907349,"fetchStart":969.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":969.8000001907349,"responseEnd":1263.0999994277954,"responseStart":1263.0999994277954,"secureConnectionStart":969.8000001907349},{"duration":310.19999980926514,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1266,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1266,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1576.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":351,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1290.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1290.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1641.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":338.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1291.1999998092651,"connectEnd":1291.1999998092651,"connectStart":1291.1999998092651,"domainLookupEnd":1291.1999998092651,"domainLookupStart":1291.1999998092651,"fetchStart":1291.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1291.1999998092651,"responseEnd":1629.3000001907349,"responseStart":1629.3000001907349,"secureConnectionStart":1291.1999998092651}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":227,"responseStart":387,"responseEnd":392,"domLoading":391,"domInteractive":1598,"domContentLoadedEventStart":1598,"domContentLoadedEventEnd":1641,"domComplete":1980,"loadEventStart":1980,"loadEventEnd":1980,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1577.3000001907349},{"name":"bigPipe.sidebar-id.end","time":1578.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1578.5},{"name":"bigPipe.activity-panel-pipe-id.end","time":1580.3999996185303},{"name":"activityTabFullyLoaded","time":1656.3000001907349}],"measures":[],"correlationId":"acff2d6f3eac8b","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":103,"dbReadsTimeInMs":15,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Runtime error is also present when using simple pattern in JSON schema with sql_mode change.
Leads to
11.1.0 83a4449ab98b5b6f08e18833bf9dd3e61e96c680 (Debug, UBASAN)
2023-04-10 13:44:01 0 [Note] /test/JSON/UBASAN_MD060423-mariadb-11.1.0-linux-x86_64-dbg/bin/mariadbd: ready for connections.
Version: '11.1.0-MariaDB-debug' socket: '/test/JSON/UBASAN_MD060423-mariadb-11.1.0-linux-x86_64-dbg/socket.sock' port: 12126 MariaDB Server
/test/JSON/11.1_dbg_san/sql/json_schema.cc:912:61: runtime error: downcast of address 0x6290000d91a0 which does not point to an object of type 'Item_string'
0x6290000d91a0: note: object is of type 'Item_null'
00 00 00 00 88 ed 5f 4b 20 56 00 00 00 00 00 00 00 00 00 00 20 fe 87 53 20 56 00 00 06 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'Item_null'
#0 0x562046d31297 in Json_schema_pattern::handle_keyword(THD*, st_json_engine_t*, char const*, char const*, List<Json_schema_keyword>*) /test/JSON/11.1_dbg_san/sql/json_schema.cc:912
#1 0x562046d5ec6b in create_object_and_handle_keyword(THD*, st_json_engine_t*, List<Json_schema_keyword>*, List<Json_schema_keyword>*) /test/JSON/11.1_dbg_san/sql/json_schema.cc:2759