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

JSON_TABLE: ASAN heap-buffer-overflow in Protocol::net_store_data or consequent failures

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: N/A
    • Fix Version/s: 10.6.0
    • Component/s: JSON
    • Labels:
      None

      Description

      SELECT * FROM JSON_TABLE('{}', '$' COLUMNS(
        a TEXT EXISTS PATH '$',
        b VARCHAR(40) PATH '$',
        c BIT(60) PATH '$',
        d VARCHAR(60) PATH '$',
        e BIT(62) PATH '$',
        f FOR ORDINALITY,
        g INT PATH '$',
        h VARCHAR(36) PATH '$',
        i DATE PATH '$',
        j CHAR(4) PATH '$'
      )) AS jt;
      

      bb-10.6-mdev17399-hf d9a80ae19

      ==1931845==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60e00002a6f4 at pc 0x7f60aedc0480 bp 0x7f60a50cc880 sp 0x7f60a50cc028
      READ of size 15 at 0x60e00002a6f4 thread T5
          #0 0x7f60aedc047f  (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f)
          #1 0x555f9947508a in Protocol::net_store_data(unsigned char const*, unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/protocol.cc:61
          #2 0x555f9947e1f6 in Protocol::store_string_aux(char const*, unsigned long, charset_info_st const*, charset_info_st const*) /data/src/bb-10.6-mdev17399-hf/sql/protocol.cc:1436
          #3 0x555f9947eb72 in Protocol_text::store_str(char const*, unsigned long, charset_info_st const*, charset_info_st const*) /data/src/bb-10.6-mdev17399-hf/sql/protocol.cc:1472
          #4 0x555f99486938 in Protocol::store(char const*, unsigned long, charset_info_st const*) /data/src/bb-10.6-mdev17399-hf/sql/protocol.h:146
          #5 0x555f99f01c73 in Field_longstr::send(Protocol*) /data/src/bb-10.6-mdev17399-hf/sql/field.cc:7265
          #6 0x555f99480341 in Protocol_text::store(Field*) /data/src/bb-10.6-mdev17399-hf/sql/protocol.cc:1588
          #7 0x555f99fee3ae in Item_field::send(Protocol*, st_value*) /data/src/bb-10.6-mdev17399-hf/sql/item.cc:7230
          #8 0x555f9947d800 in Protocol::send_result_set_row(List<Item>*) /data/src/bb-10.6-mdev17399-hf/sql/protocol.cc:1331
          #9 0x555f9962b877 in select_send::send_data(List<Item>&) /data/src/bb-10.6-mdev17399-hf/sql/sql_class.cc:3020
          #10 0x555f998ed4de in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /data/src/bb-10.6-mdev17399-hf/sql/sql_class.h:5567
          #11 0x555f998a84e7 in end_send /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:21951
          #12 0x555f998a0880 in evaluate_join_record /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20974
          #13 0x555f9989f1d6 in sub_select(JOIN*, st_join_table*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20751
          #14 0x555f9989d3c7 in do_select /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20298
          #15 0x555f99828bae in JOIN::exec_inner() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4508
          #16 0x555f99826199 in JOIN::exec() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4288
          #17 0x555f9982a5e8 in mysql_select(THD*, TABLE_LIST*, 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/bb-10.6-mdev17399-hf/sql/sql_select.cc:4764
          #18 0x555f997fb677 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:420
          #19 0x555f9976523d in execute_sqlcom_select /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:6231
          #20 0x555f99754522 in mysql_execute_command(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:3927
          #21 0x555f997704b6 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:8005
          #22 0x555f99746f2f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1888
          #23 0x555f99743c6a in do_command(THD*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1399
          #24 0x555f99b86c19 in do_handle_one_connection(CONNECT*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1410
          #25 0x555f99b86576 in handle_one_connection /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1312
          #26 0x555f9a897cbe in pfs_spawn_thread /data/src/bb-10.6-mdev17399-hf/storage/perfschema/pfs.cc:2201
          #27 0x7f60ae8e2608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
          #28 0x7f60ae4b6292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
       
      0x60e00002a6f4 is located 0 bytes to the right of 148-byte region [0x60e00002a660,0x60e00002a6f4)
      allocated by thread T5 here:
          #0 0x7f60aee32bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
          #1 0x555f9b4df477 in sf_malloc /data/src/bb-10.6-mdev17399-hf/mysys/safemalloc.c:121
          #2 0x555f9b4abfbf in my_malloc /data/src/bb-10.6-mdev17399-hf/mysys/my_malloc.c:90
          #3 0x555f999ae809 in Binary_string::real_alloc(unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_string.cc:44
          #4 0x555f99484d53 in Binary_string::alloc(unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_string.h:639
          #5 0x555f99f0cf57 in Field_blob::store(char const*, unsigned long, charset_info_st const*) /data/src/bb-10.6-mdev17399-hf/sql/field.cc:8603
          #6 0x555f99f027eb in Field_str::store(double) /data/src/bb-10.6-mdev17399-hf/sql/field.cc:7333
          #7 0x555f99db492a in ha_json_table::fill_column_values(unsigned char*, unsigned char*) /data/src/bb-10.6-mdev17399-hf/sql/json_table.cc:504
          #8 0x555f99db3db1 in ha_json_table::rnd_next(unsigned char*) /data/src/bb-10.6-mdev17399-hf/sql/json_table.cc:403
          #9 0x555f99f754d3 in handler::ha_rnd_next(unsigned char*) /data/src/bb-10.6-mdev17399-hf/sql/handler.cc:3068
          #10 0x555f9a3d3900 in rr_sequential(READ_RECORD*) /data/src/bb-10.6-mdev17399-hf/sql/records.cc:519
          #11 0x555f99595323 in READ_RECORD::read_record() /data/src/bb-10.6-mdev17399-hf/sql/records.h:81
          #12 0x555f998a603d in join_init_read_record(st_join_table*) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:21726
          #13 0x555f9989f01a in sub_select(JOIN*, st_join_table*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20748
          #14 0x555f9989d3c7 in do_select /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20298
          #15 0x555f99828bae in JOIN::exec_inner() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4508
          #16 0x555f99826199 in JOIN::exec() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4288
          #17 0x555f9982a5e8 in mysql_select(THD*, TABLE_LIST*, 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/bb-10.6-mdev17399-hf/sql/sql_select.cc:4764
          #18 0x555f997fb677 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:420
          #19 0x555f9976523d in execute_sqlcom_select /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:6231
          #20 0x555f99754522 in mysql_execute_command(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:3927
          #21 0x555f997704b6 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:8005
          #22 0x555f99746f2f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1888
          #23 0x555f99743c6a in do_command(THD*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1399
          #24 0x555f99b86c19 in do_handle_one_connection(CONNECT*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1410
          #25 0x555f99b86576 in handle_one_connection /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1312
          #26 0x555f9a897cbe in pfs_spawn_thread /data/src/bb-10.6-mdev17399-hf/storage/perfschema/pfs.cc:2201
          #27 0x7f60ae8e2608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
       
      Thread T5 created by T0 here:
          #0 0x7f60aed5f805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805)
          #1 0x555f9a892c62 in my_thread_create /data/src/bb-10.6-mdev17399-hf/storage/perfschema/my_thread.h:38
          #2 0x555f9a8980b1 in pfs_spawn_thread_v1 /data/src/bb-10.6-mdev17399-hf/storage/perfschema/pfs.cc:2252
          #3 0x555f99437c38 in inline_mysql_thread_create /data/src/bb-10.6-mdev17399-hf/include/mysql/psi/mysql_thread.h:1139
          #4 0x555f9944f129 in create_thread_to_handle_connection(CONNECT*) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:5891
          #5 0x555f9944f7a8 in create_new_thread(CONNECT*) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:5950
          #6 0x555f9944fb15 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:6012
          #7 0x555f994504e0 in handle_connections_sockets() /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:6136
          #8 0x555f9944e936 in mysqld_main(int, char**) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:5786
          #9 0x555f99436f5c in main /data/src/bb-10.6-mdev17399-hf/sql/main.cc:25
          #10 0x7f60ae3bb0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
       
      SUMMARY: AddressSanitizer: heap-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f) 
      Shadow bytes around the buggy address:
        0x0c1c7fffd480: 00 00 00 00 00 00 00 00 00 00 04 fa fa fa fa fa
        0x0c1c7fffd490: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c1c7fffd4a0: 00 00 00 00 00 00 04 fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd4b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c1c7fffd4c0: 00 00 04 fa fa fa fa fa fa fa fa fa 00 00 00 00
      =>0x0c1c7fffd4d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00[04]fa
        0x0c1c7fffd4e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd4f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd500: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd510: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd520: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      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
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        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
        Shadow gap:              cc
      ==1931845==ABORTING
      

      or as CREATE.. SELECT:

      CREATE TABLE tmp AS SELECT * FROM JSON_TABLE('{}', '$' COLUMNS(
        a TEXT EXISTS PATH '$',
        b VARCHAR(40) PATH '$',
        c BIT(60) PATH '$',
        d VARCHAR(60) PATH '$',
        e BIT(62) PATH '$',
        f FOR ORDINALITY,
        g INT PATH '$',
        h VARCHAR(36) PATH '$',
        i DATE PATH '$',
        j CHAR(4) PATH '$'
      )) AS jt;
      

      bb-10.6-mdev17399-hf d9a80ae19

      ==1944751==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60e00002c214 at pc 0x7fa2f9a14480 bp 0x7fa2efd1ea80 sp 0x7fa2efd1e228
      READ of size 15 at 0x60e00002c214 thread T5
          #0 0x7fa2f9a1447f  (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f)
          #1 0x55e3fe717a78 in _mi_rec_pack /data/src/bb-10.6-mdev17399-hf/storage/myisam/mi_dynrec.c:998
          #2 0x55e3fe70f292 in _mi_write_blob_record /data/src/bb-10.6-mdev17399-hf/storage/myisam/mi_dynrec.c:290
          #3 0x55e3fe781164 in mi_write /data/src/bb-10.6-mdev17399-hf/storage/myisam/mi_write.c:146
          #4 0x55e3fe6b9099 in ha_myisam::write_row(unsigned char const*) /data/src/bb-10.6-mdev17399-hf/storage/myisam/ha_myisam.cc:954
          #5 0x55e3fd346d4e in handler::ha_write_row(unsigned char const*) /data/src/bb-10.6-mdev17399-hf/sql/handler.cc:7160
          #6 0x55e3fca44543 in write_record(THD*, TABLE*, st_copy_info*, select_result*) /data/src/bb-10.6-mdev17399-hf/sql/sql_insert.cc:2106
          #7 0x55e3fca5523a in select_insert::send_data(List<Item>&) /data/src/bb-10.6-mdev17399-hf/sql/sql_insert.cc:4060
          #8 0x55e3fcc994de in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /data/src/bb-10.6-mdev17399-hf/sql/sql_class.h:5567
          #9 0x55e3fcc544e7 in end_send /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:21951
          #10 0x55e3fcc4c880 in evaluate_join_record /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20974
          #11 0x55e3fcc4b1d6 in sub_select(JOIN*, st_join_table*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20751
          #12 0x55e3fcc493c7 in do_select /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20298
          #13 0x55e3fcbd4bae in JOIN::exec_inner() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4508
          #14 0x55e3fcbd2199 in JOIN::exec() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4288
          #15 0x55e3fcbd65e8 in mysql_select(THD*, TABLE_LIST*, 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/bb-10.6-mdev17399-hf/sql/sql_select.cc:4764
          #16 0x55e3fcba7677 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:420
          #17 0x55e3fcdbc31d in Sql_cmd_create_table_like::execute(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_table.cc:12205
          #18 0x55e3fcb0ecbb in mysql_execute_command(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:5973
          #19 0x55e3fcb1c4b6 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:8005
          #20 0x55e3fcaf2f2f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1888
          #21 0x55e3fcaefc6a in do_command(THD*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1399
          #22 0x55e3fcf32c19 in do_handle_one_connection(CONNECT*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1410
          #23 0x55e3fcf32576 in handle_one_connection /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1312
          #24 0x55e3fdc43cbe in pfs_spawn_thread /data/src/bb-10.6-mdev17399-hf/storage/perfschema/pfs.cc:2201
          #25 0x7fa2f9536608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
          #26 0x7fa2f910a292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
       
      0x60e00002c214 is located 0 bytes to the right of 148-byte region [0x60e00002c180,0x60e00002c214)
      allocated by thread T5 here:
          #0 0x7fa2f9a86bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
          #1 0x55e3fe88b477 in sf_malloc /data/src/bb-10.6-mdev17399-hf/mysys/safemalloc.c:121
          #2 0x55e3fe857fbf in my_malloc /data/src/bb-10.6-mdev17399-hf/mysys/my_malloc.c:90
          #3 0x55e3fcd5a809 in Binary_string::real_alloc(unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_string.cc:44
          #4 0x55e3fc830d53 in Binary_string::alloc(unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_string.h:639
          #5 0x55e3fd2b8f57 in Field_blob::store(char const*, unsigned long, charset_info_st const*) /data/src/bb-10.6-mdev17399-hf/sql/field.cc:8603
          #6 0x55e3fd2ae7eb in Field_str::store(double) /data/src/bb-10.6-mdev17399-hf/sql/field.cc:7333
          #7 0x55e3fd16092a in ha_json_table::fill_column_values(unsigned char*, unsigned char*) /data/src/bb-10.6-mdev17399-hf/sql/json_table.cc:504
          #8 0x55e3fd15fdb1 in ha_json_table::rnd_next(unsigned char*) /data/src/bb-10.6-mdev17399-hf/sql/json_table.cc:403
          #9 0x55e3fd3214d3 in handler::ha_rnd_next(unsigned char*) /data/src/bb-10.6-mdev17399-hf/sql/handler.cc:3068
          #10 0x55e3fd77f900 in rr_sequential(READ_RECORD*) /data/src/bb-10.6-mdev17399-hf/sql/records.cc:519
          #11 0x55e3fc941323 in READ_RECORD::read_record() /data/src/bb-10.6-mdev17399-hf/sql/records.h:81
          #12 0x55e3fcc5203d in join_init_read_record(st_join_table*) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:21726
          #13 0x55e3fcc4b01a in sub_select(JOIN*, st_join_table*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20748
          #14 0x55e3fcc493c7 in do_select /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20298
          #15 0x55e3fcbd4bae in JOIN::exec_inner() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4508
          #16 0x55e3fcbd2199 in JOIN::exec() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4288
          #17 0x55e3fcbd65e8 in mysql_select(THD*, TABLE_LIST*, 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/bb-10.6-mdev17399-hf/sql/sql_select.cc:4764
          #18 0x55e3fcba7677 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:420
          #19 0x55e3fcdbc31d in Sql_cmd_create_table_like::execute(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_table.cc:12205
          #20 0x55e3fcb0ecbb in mysql_execute_command(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:5973
          #21 0x55e3fcb1c4b6 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:8005
          #22 0x55e3fcaf2f2f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1888
          #23 0x55e3fcaefc6a in do_command(THD*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1399
          #24 0x55e3fcf32c19 in do_handle_one_connection(CONNECT*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1410
          #25 0x55e3fcf32576 in handle_one_connection /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1312
          #26 0x55e3fdc43cbe in pfs_spawn_thread /data/src/bb-10.6-mdev17399-hf/storage/perfschema/pfs.cc:2201
          #27 0x7fa2f9536608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
       
      Thread T5 created by T0 here:
          #0 0x7fa2f99b3805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805)
          #1 0x55e3fdc3ec62 in my_thread_create /data/src/bb-10.6-mdev17399-hf/storage/perfschema/my_thread.h:38
          #2 0x55e3fdc440b1 in pfs_spawn_thread_v1 /data/src/bb-10.6-mdev17399-hf/storage/perfschema/pfs.cc:2252
          #3 0x55e3fc7e3c38 in inline_mysql_thread_create /data/src/bb-10.6-mdev17399-hf/include/mysql/psi/mysql_thread.h:1139
          #4 0x55e3fc7fb129 in create_thread_to_handle_connection(CONNECT*) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:5891
          #5 0x55e3fc7fb7a8 in create_new_thread(CONNECT*) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:5950
          #6 0x55e3fc7fbb15 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:6012
          #7 0x55e3fc7fc4e0 in handle_connections_sockets() /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:6136
          #8 0x55e3fc7fa936 in mysqld_main(int, char**) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:5786
          #9 0x55e3fc7e2f5c in main /data/src/bb-10.6-mdev17399-hf/sql/main.cc:25
          #10 0x7fa2f900f0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
       
      SUMMARY: AddressSanitizer: heap-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f) 
      Shadow bytes around the buggy address:
        0x0c1c7fffd7f0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
        0x0c1c7fffd800: 00 00 00 00 00 00 00 00 00 00 00 04 fa fa fa fa
        0x0c1c7fffd810: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c1c7fffd820: 00 00 00 00 00 00 04 fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd830: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>0x0c1c7fffd840: 00 00[04]fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd850: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd860: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd870: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c7fffd890: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      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
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        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
        Shadow gap:              cc
      ==1944751==ABORTING
      

      or with InnoDB:

      ==1944878==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60e000045d54 at pc 0x7f87720e8480 bp 0x7f8762587880 sp 0x7f8762587028
      READ of size 15 at 0x60e000045d54 thread T12
          #0 0x7f87720e847f  (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f)
          #1 0x55f405918ac8 in rec_convert_dtuple_to_rec_comp<> /data/src/bb-10.6-mdev17399-hf/storage/innobase/rem/rem0rec.cc:1659
          #2 0x55f405905cd0 in rec_convert_dtuple_to_rec_new /data/src/bb-10.6-mdev17399-hf/storage/innobase/rem/rem0rec.cc:1705
          #3 0x55f405906045 in rec_convert_dtuple_to_rec(unsigned char*, dict_index_t const*, dtuple_t const*, unsigned long) /data/src/bb-10.6-mdev17399-hf/storage/innobase/rem/rem0rec.cc:1739
          #4 0x55f405b9e9fe in page_cur_tuple_insert /data/src/bb-10.6-mdev17399-hf/storage/innobase/include/page0cur.ic:272
          #5 0x55f405bb6989 in btr_cur_optimistic_insert(unsigned long, btr_cur_t*, unsigned short**, mem_block_info_t**, dtuple_t*, unsigned char**, big_rec_t**, unsigned long, que_thr_t*, mtr_t*) /data/src/bb-10.6-mdev17399-hf/storage/innobase/btr/btr0cur.cc:3558
          #6 0x55f40596b667 in row_ins_clust_index_entry_low(unsigned long, unsigned long, dict_index_t*, unsigned long, dtuple_t*, unsigned long, que_thr_t*) /data/src/bb-10.6-mdev17399-hf/storage/innobase/row/row0ins.cc:2785
          #7 0x55f40596e012 in row_ins_clust_index_entry(dict_index_t*, dtuple_t*, que_thr_t*, unsigned long) /data/src/bb-10.6-mdev17399-hf/storage/innobase/row/row0ins.cc:3257
          #8 0x55f40596e9fe in row_ins_index_entry /data/src/bb-10.6-mdev17399-hf/storage/innobase/row/row0ins.cc:3382
          #9 0x55f40596fb6f in row_ins_index_entry_step /data/src/bb-10.6-mdev17399-hf/storage/innobase/row/row0ins.cc:3551
          #10 0x55f40597064a in row_ins /data/src/bb-10.6-mdev17399-hf/storage/innobase/row/row0ins.cc:3697
          #11 0x55f4059717c7 in row_ins_step(que_thr_t*) /data/src/bb-10.6-mdev17399-hf/storage/innobase/row/row0ins.cc:3839
          #12 0x55f4059bb58e in row_insert_for_mysql(unsigned char const*, row_prebuilt_t*, ins_mode_t) /data/src/bb-10.6-mdev17399-hf/storage/innobase/row/row0mysql.cc:1393
          #13 0x55f40561c906 in ha_innobase::write_row(unsigned char const*) /data/src/bb-10.6-mdev17399-hf/storage/innobase/handler/ha_innodb.cc:7438
          #14 0x55f404b22d4e in handler::ha_write_row(unsigned char const*) /data/src/bb-10.6-mdev17399-hf/sql/handler.cc:7160
          #15 0x55f404220543 in write_record(THD*, TABLE*, st_copy_info*, select_result*) /data/src/bb-10.6-mdev17399-hf/sql/sql_insert.cc:2106
          #16 0x55f40423123a in select_insert::send_data(List<Item>&) /data/src/bb-10.6-mdev17399-hf/sql/sql_insert.cc:4060
          #17 0x55f4044754de in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /data/src/bb-10.6-mdev17399-hf/sql/sql_class.h:5567
          #18 0x55f4044304e7 in end_send /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:21951
          #19 0x55f404428880 in evaluate_join_record /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20974
          #20 0x55f4044271d6 in sub_select(JOIN*, st_join_table*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20751
          #21 0x55f4044253c7 in do_select /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20298
          #22 0x55f4043b0bae in JOIN::exec_inner() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4508
          #23 0x55f4043ae199 in JOIN::exec() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4288
          #24 0x55f4043b25e8 in mysql_select(THD*, TABLE_LIST*, 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/bb-10.6-mdev17399-hf/sql/sql_select.cc:4764
          #25 0x55f404383677 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:420
          #26 0x55f40459831d in Sql_cmd_create_table_like::execute(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_table.cc:12205
          #27 0x55f4042eacbb in mysql_execute_command(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:5973
          #28 0x55f4042f84b6 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:8005
          #29 0x55f4042cef2f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1888
          #30 0x55f4042cbc6a in do_command(THD*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1399
          #31 0x55f40470ec19 in do_handle_one_connection(CONNECT*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1410
          #32 0x55f40470e576 in handle_one_connection /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1312
          #33 0x55f40541fcbe in pfs_spawn_thread /data/src/bb-10.6-mdev17399-hf/storage/perfschema/pfs.cc:2201
          #34 0x7f8771c0a608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
          #35 0x7f87717de292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
       
      0x60e000045d54 is located 0 bytes to the right of 148-byte region [0x60e000045cc0,0x60e000045d54)
      allocated by thread T12 here:
          #0 0x7f877215abc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
          #1 0x55f406067477 in sf_malloc /data/src/bb-10.6-mdev17399-hf/mysys/safemalloc.c:121
          #2 0x55f406033fbf in my_malloc /data/src/bb-10.6-mdev17399-hf/mysys/my_malloc.c:90
          #3 0x55f404536809 in Binary_string::real_alloc(unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_string.cc:44
          #4 0x55f40400cd53 in Binary_string::alloc(unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_string.h:639
          #5 0x55f404a94f57 in Field_blob::store(char const*, unsigned long, charset_info_st const*) /data/src/bb-10.6-mdev17399-hf/sql/field.cc:8603
          #6 0x55f404a8a7eb in Field_str::store(double) /data/src/bb-10.6-mdev17399-hf/sql/field.cc:7333
          #7 0x55f40493c92a in ha_json_table::fill_column_values(unsigned char*, unsigned char*) /data/src/bb-10.6-mdev17399-hf/sql/json_table.cc:504
          #8 0x55f40493bdb1 in ha_json_table::rnd_next(unsigned char*) /data/src/bb-10.6-mdev17399-hf/sql/json_table.cc:403
          #9 0x55f404afd4d3 in handler::ha_rnd_next(unsigned char*) /data/src/bb-10.6-mdev17399-hf/sql/handler.cc:3068
          #10 0x55f404f5b900 in rr_sequential(READ_RECORD*) /data/src/bb-10.6-mdev17399-hf/sql/records.cc:519
          #11 0x55f40411d323 in READ_RECORD::read_record() /data/src/bb-10.6-mdev17399-hf/sql/records.h:81
          #12 0x55f40442e03d in join_init_read_record(st_join_table*) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:21726
          #13 0x55f40442701a in sub_select(JOIN*, st_join_table*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20748
          #14 0x55f4044253c7 in do_select /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:20298
          #15 0x55f4043b0bae in JOIN::exec_inner() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4508
          #16 0x55f4043ae199 in JOIN::exec() /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:4288
          #17 0x55f4043b25e8 in mysql_select(THD*, TABLE_LIST*, 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/bb-10.6-mdev17399-hf/sql/sql_select.cc:4764
          #18 0x55f404383677 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.6-mdev17399-hf/sql/sql_select.cc:420
          #19 0x55f40459831d in Sql_cmd_create_table_like::execute(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_table.cc:12205
          #20 0x55f4042eacbb in mysql_execute_command(THD*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:5973
          #21 0x55f4042f84b6 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:8005
          #22 0x55f4042cef2f in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1888
          #23 0x55f4042cbc6a in do_command(THD*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_parse.cc:1399
          #24 0x55f40470ec19 in do_handle_one_connection(CONNECT*, bool) /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1410
          #25 0x55f40470e576 in handle_one_connection /data/src/bb-10.6-mdev17399-hf/sql/sql_connect.cc:1312
          #26 0x55f40541fcbe in pfs_spawn_thread /data/src/bb-10.6-mdev17399-hf/storage/perfschema/pfs.cc:2201
          #27 0x7f8771c0a608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477
       
      Thread T12 created by T0 here:
          #0 0x7f8772087805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805)
          #1 0x55f40541ac62 in my_thread_create /data/src/bb-10.6-mdev17399-hf/storage/perfschema/my_thread.h:38
          #2 0x55f4054200b1 in pfs_spawn_thread_v1 /data/src/bb-10.6-mdev17399-hf/storage/perfschema/pfs.cc:2252
          #3 0x55f403fbfc38 in inline_mysql_thread_create /data/src/bb-10.6-mdev17399-hf/include/mysql/psi/mysql_thread.h:1139
          #4 0x55f403fd7129 in create_thread_to_handle_connection(CONNECT*) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:5891
          #5 0x55f403fd77a8 in create_new_thread(CONNECT*) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:5950
          #6 0x55f403fd7b15 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:6012
          #7 0x55f403fd84e0 in handle_connections_sockets() /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:6136
          #8 0x55f403fd6936 in mysqld_main(int, char**) /data/src/bb-10.6-mdev17399-hf/sql/mysqld.cc:5786
          #9 0x55f403fbef5c in main /data/src/bb-10.6-mdev17399-hf/sql/main.cc:25
          #10 0x7f87716e30b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
       
      SUMMARY: AddressSanitizer: heap-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0x9b47f) 
      Shadow bytes around the buggy address:
        0x0c1c80000b50: 00 00 00 00 00 00 04 fa fa fa fa fa fa fa fa fa
        0x0c1c80000b60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c1c80000b70: 00 00 04 fa fa fa fa fa fa fa fa fa 00 00 00 00
        0x0c1c80000b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 fa
        0x0c1c80000b90: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
      =>0x0c1c80000ba0: 00 00 00 00 00 00 00 00 00 00[04]fa fa fa fa fa
        0x0c1c80000bb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c80000bc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c80000bd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c80000be0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c80000bf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      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
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        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
        Shadow gap:              cc
      ==1944878==ABORTING
      

        Attachments

          Activity

            People

            Assignee:
            holyfoot Alexey Botchkov
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: