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

AddressSanitizer: use-after-poison in Item_direct_view_ref::get_null_ref_table

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (f VARCHAR(512));
      INSERT INTO t VALUES ('a'),('b');
      SELECT * FROM t HAVING f = 'foo';
       
      # Cleanup
      DROP TABLE t;
      

      10.4 83d368a0

      ==12425==ERROR: AddressSanitizer: use-after-poison on address 0x62b000063140 at pc 0x5575bb0b2423 bp 0x7fbe01b33a90 sp 0x7fbe01b33a88
      READ of size 8 at 0x62b000063140 thread T5
          #0 0x5575bb0b2422 in Item_direct_view_ref::get_null_ref_table() const /data/src/10.4/sql/item.h:5643
          #1 0x5575bb04cf8b in check_simple_equality(THD*, Value_source::Context const&, Item*, Item*, COND_EQUAL*) /data/src/10.4/sql/sql_select.cc:14342
          #2 0x5575bb04eeb4 in Item_func_eq::check_equality(THD*, COND_EQUAL*, List<Item>*) /data/src/10.4/sql/sql_select.cc:14678
          #3 0x5575bb04fcbe in Item_func_eq::build_equal_items(THD*, COND_EQUAL*, bool, COND_EQUAL**) /data/src/10.4/sql/sql_select.cc:14895
          #4 0x5575bb050d60 in build_equal_items /data/src/10.4/sql/sql_select.cc:15065
          #5 0x5575bb059c31 in optimize_cond /data/src/10.4/sql/sql_select.cc:16706
          #6 0x5575baff1e71 in JOIN::optimize_inner() /data/src/10.4/sql/sql_select.cc:1952
          #7 0x5575bafee44a in JOIN::optimize() /data/src/10.4/sql/sql_select.cc:1563
          #8 0x5575bb00b5ca in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.4/sql/sql_select.cc:4592
          #9 0x5575bafe2316 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.4/sql/sql_select.cc:425
          #10 0x5575baf67a77 in execute_sqlcom_select /data/src/10.4/sql/sql_parse.cc:6356
          #11 0x5575baf55fac in mysql_execute_command(THD*) /data/src/10.4/sql/sql_parse.cc:3898
          #12 0x5575baf6fc2b in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.4/sql/sql_parse.cc:7908
          #13 0x5575baf4a15f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.4/sql/sql_parse.cc:1843
          #14 0x5575baf4706d in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1360
          #15 0x5575bb2bbcca in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1404
          #16 0x5575bb2bb67e in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1306
          #17 0x5575bc63a99f in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1862
          #18 0x7fbe0c3344a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
          #19 0x7fbe0a87cd0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
       
      0x62b000063140 is located 3904 bytes inside of 24716-byte region [0x62b000062200,0x62b00006828c)
      allocated by thread T5 here:
          #0 0x7fbe0c60bd28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
          #1 0x5575bc763d9e in sf_malloc /data/src/10.4/mysys/safemalloc.c:118
          #2 0x5575bc736099 in my_malloc /data/src/10.4/mysys/my_malloc.c:101
          #3 0x5575bc715fa3 in reset_root_defaults /data/src/10.4/mysys/my_alloc.c:151
          #4 0x5575bae4f93f in THD::init_for_queries() /data/src/10.4/sql/sql_class.cc:1387
          #5 0x5575bb2bb03b in prepare_new_connection_state(THD*) /data/src/10.4/sql/sql_connect.cc:1237
          #6 0x5575bb2bb6c4 in thd_prepare_connection(THD*) /data/src/10.4/sql/sql_connect.cc:1321
          #7 0x5575bb2bbc74 in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1391
          #8 0x5575bb2bb67e in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1306
          #9 0x5575bc63a99f in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1862
          #10 0x7fbe0c3344a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      Thread T5 created by T0 here:
          #0 0x7fbe0c57af59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x5575bc63ad8c in spawn_thread_v1 /data/src/10.4/storage/perfschema/pfs.cc:1912
          #2 0x5575bacaf148 in inline_mysql_thread_create /data/src/10.4/include/mysql/psi/mysql_thread.h:1268
          #3 0x5575bacc327a in create_thread_to_handle_connection(CONNECT*) /data/src/10.4/sql/mysqld.cc:6238
          #4 0x5575bacc395d in create_new_thread(CONNECT*) /data/src/10.4/sql/mysqld.cc:6308
          #5 0x5575bacc3ce8 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/10.4/sql/mysqld.cc:6406
          #6 0x5575bacc493a in handle_connections_sockets() /data/src/10.4/sql/mysqld.cc:6564
          #7 0x5575bacc2afb in mysqld_main(int, char**) /data/src/10.4/sql/mysqld.cc:5896
          #8 0x5575bacad02f in main /data/src/10.4/sql/main.cc:25
          #9 0x7fbe0a7b42e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
       
      SUMMARY: AddressSanitizer: use-after-poison /data/src/10.4/sql/item.h:5643 in Item_direct_view_ref::get_null_ref_table() const
      Shadow bytes around the buggy address:
        0x0c56800045d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c56800045e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c56800045f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 05
        0x0c5680004600: f7 00 00 f7 02 f7 00 00 00 00 00 00 00 00 00 00
        0x0c5680004610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c5680004620: 00 00 00 00 00 00 f7 04[f7]00 00 00 00 00 00 00
        0x0c5680004630: 00 00 00 00 00 00 00 00 00 00 f7 00 02 f7 00 00
        0x0c5680004640: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5680004650: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5680004660: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c5680004670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07 
        Heap left redzone:       fa
        Heap right redzone:      fb
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        Stack partial redzone:   f4
        Stack after return:      f5
        Stack use after scope:   f8
        Global redzone:          f9
        Global init order:       f6
        Poisoned by user:        f7
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
        Left alloca redzone:     ca
        Right alloca redzone:    cb
      ==12425==ABORTING
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.