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

ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (a CHAR);
      CREATE TABLE t2 (b ENUM('foo','bar'));
      INSERT INTO t1 VALUES ('1');
       
      INSERT INTO t2 SELECT * FROM t1;
       
      # Cleanup
      DROP TABLE t1, t2;
      

      10.0 1144acbcbd ASAN debug

      =================================================================
      ==26245==ERROR: AddressSanitizer: unknown-crash on address 0x6190000bdc0a at pc 0x1925212 bp 0x7f8af27195c0 sp 0x7f8af27195b8
      READ of size 1 at 0x6190000bdc0a thread T5
          #0 0x1925211 in my_strntoul_8bit /data/src/10.0/strings/ctype-simple.c:492
          #1 0xb37db9 in Field_enum::store(char const*, unsigned int, charset_info_st const*) /data/src/10.0/sql/field.cc:8013
          #2 0xb5671a in field_conv_incompatible(Field*, Field*) /data/src/10.0/sql/field_conv.cc:948
          #3 0xb56a20 in field_conv(Field*, Field*) /data/src/10.0/sql/field_conv.cc:875
          #4 0xb9cec6 in save_field_in_field /data/src/10.0/sql/item.cc:5877
          #5 0xb9cfcd in Item_field::save_in_field(Field*, bool) /data/src/10.0/sql/item.cc:5933
          #6 0x5fdb4f in fill_record(THD*, TABLE*, Field**, List<Item>&, bool, bool) /data/src/10.0/sql/sql_base.cc:8967
          #7 0x5fdea4 in fill_record_n_invoke_before_triggers(THD*, TABLE*, Field**, List<Item>&, bool, trg_event_type) /data/src/10.0/sql/sql_base.cc:9014
          #8 0x672ce5 in select_insert::store_values(List<Item>&) /data/src/10.0/sql/sql_insert.cc:3688
          #9 0x67b69f in select_insert::send_data(List<Item>&) /data/src/10.0/sql/sql_insert.cc:3622
          #10 0x7a58c8 in end_send /data/src/10.0/sql/sql_select.cc:19123
          #11 0x79bd99 in do_select /data/src/10.0/sql/sql_select.cc:17615
          #12 0x7df26d in JOIN::exec_inner() /data/src/10.0/sql/sql_select.cc:3123
          #13 0x7e0615 in JOIN::exec() /data/src/10.0/sql/sql_select.cc:2409
          #14 0x7d5778 in mysql_select(THD*, Item***, 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.0/sql/sql_select.cc:3348
          #15 0x7d5da8 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.0/sql/sql_select.cc:377
          #16 0x6d7896 in mysql_execute_command(THD*) /data/src/10.0/sql/sql_parse.cc:3543
          #17 0x6e4990 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/10.0/sql/sql_parse.cc:6637
          #18 0x6e85af in dispatch_command(enum_server_command, THD*, char*, unsigned int) /data/src/10.0/sql/sql_parse.cc:1300
          #19 0x6ecea8 in do_command(THD*) /data/src/10.0/sql/sql_parse.cc:1003
          #20 0x97cad3 in do_handle_one_connection(THD*) /data/src/10.0/sql/sql_connect.cc:1377
          #21 0x97cd3a in handle_one_connection /data/src/10.0/sql/sql_connect.cc:1292
          #22 0x11b5b34 in pfs_spawn_thread /data/src/10.0/storage/perfschema/pfs.cc:1861
          #23 0x7f8afcd2e493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
          #24 0x7f8afb0e793e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
       
      0x6190000bdc0a is located 138 bytes inside of 1100-byte region [0x6190000bdb80,0x6190000bdfcc)
      allocated by thread T5 here:
          #0 0x7f8afcf9873f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
          #1 0x18f532f in sf_malloc /data/src/10.0/mysys/safemalloc.c:115
          #2 0x19d808a (/data/bld/10.0-asan/bin/mysqld+0x19d808a)
       
      Thread T5 created by T0 here:
          #0 0x7f8afcf67bba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
          #1 0x11c138b in spawn_thread_v1 /data/src/10.0/storage/perfschema/pfs.cc:1911
       
      SUMMARY: AddressSanitizer: unknown-crash /data/src/10.0/strings/ctype-simple.c:492 my_strntoul_8bit
      Shadow bytes around the buggy address:
        0x0c328000fb30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c328000fb40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c328000fb50: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa
        0x0c328000fb60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c328000fb70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c328000fb80: 00[02]02 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c328000fb90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c328000fba0: 00 00 00 00 00 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c328000fbb0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c328000fbc0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
        0x0c328000fbd0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
      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
        Contiguous container OOB:fc
        ASan internal:           fe
      ==26245==ABORTING
      

      Reproducible with at least MyISAM and InnoDB.
      No visible effect on non-ASAN builds, but it might be the matter of luck.

      Attachments

        Activity

          People

            bar Alexander Barkov
            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.