Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-31032

UBSAN|downcast of address X which does not point to an object of type 'Item_string' in sql/json_schema.cc

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 11.1
    • 11.1.1
    • JSON
    • None

    Description

      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
      

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.