Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.4.1
-
None
-
None
-
Ubuntu 20.04, tags/mariadb-11.4.1, AddressSanitizer enabled
Description
PoC:
SELECT COLUMN_JSON(REPEAT(COLUMN_CREATE(1, 'val', 2, COLUMN_CREATE(3, 'val2')), 131072)); |
ASAN report. This ASAN report is very similar to MDEV-31566, but I have tried 31566's fix in pull #2892, and the bug in 31566 disappears while this heap buffer overflow still exists. So this should be a different bug from 31566.
=================================================================
|
==574491==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f3eb5357ca0 at pc 0x0000023bec59 bp 0x7f3ec2cc82b0 sp 0x7f3ec2cc82a8
|
WRITE of size 1 at 0x7f3eb5357ca0 thread T11
|
#0 0x23bec58 in dynstr_append_json_quoted /root/mariadb/mysys/ma_dyncol.c
|
#1 0x23bec58 in mariadb_dyncol_val_str /root/mariadb/mysys/ma_dyncol.c:3950:17
|
#2 0x23c09b0 in mariadb_dyncol_json_internal /root/mariadb/mysys/ma_dyncol.c:4252:16
|
#3 0x23c0987 in mariadb_dyncol_json_internal /root/mariadb/mysys/ma_dyncol.c:4243:11
|
#4 0x15e26ba in Item_func_dyncol_json::val_str(String*) /root/mariadb/sql/item_strfunc.cc:5172:12
|
#5 0x11831a9 in Type_handler::Item_send_str(Item*, Protocol*, st_value*) const /root/mariadb/sql/sql_type.cc:7496:19
|
#6 0x90ea0a in Protocol::send_result_set_row(List<Item>*) /root/mariadb/sql/protocol.cc:1333:15
|
#7 0xa7584c in select_send::send_data(List<Item>&) /root/mariadb/sql/sql_class.cc:3187:17
|
#8 0xcb3d4d in select_result_sink::send_data_with_check(List<Item>&, st_select_lex_unit*, unsigned long long) /root/mariadb/sql/sql_class.h:5995:12
|
#9 0xcb3d4d in JOIN::exec_inner() /root/mariadb/sql/sql_select.cc:4862:22
|
#10 0xcb1198 in JOIN::exec() /root/mariadb/sql/sql_select.cc:4774:8
|
#11 0xc527c7 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*) /root/mariadb/sql/sql_select.cc:5304:21
|
#12 0xc51c68 in handle_select(THD*, LEX*, select_result*, unsigned long long) /root/mariadb/sql/sql_select.cc:630:10
|
#13 0xba71f1 in execute_sqlcom_select(THD*, TABLE_LIST*) /root/mariadb/sql/sql_parse.cc:6094:12
|
#14 0xb95e8b in mysql_execute_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:3943:12
|
#15 0xc22e52 in Prepared_statement::execute(String*, bool) /root/mariadb/sql/sql_prepare.cc:5076:14
|
#16 0xc1c93a in Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) /root/mariadb/sql/sql_prepare.cc:4461:10
|
#17 0xc1b646 in mysql_stmt_execute_common(THD*, unsigned long, unsigned char*, unsigned char*, unsigned long, bool, bool) /root/mariadb/sql/sql_prepare.cc:3368:11
|
#18 0xc1affe in mysqld_stmt_execute(THD*, char*, unsigned int) /root/mariadb/sql/sql_prepare.cc:3139:3
|
#19 0xb81a77 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /root/mariadb/sql/sql_parse.cc:1818:5
|
#20 0xb89c41 in do_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:1406:17
|
#21 0xf82df8 in do_handle_one_connection(CONNECT*, bool) /root/mariadb/sql/sql_connect.cc:1437:11
|
#22 0xf82848 in handle_one_connection /root/mariadb/sql/sql_connect.cc:1339:5
|
#23 0x1b267da in pfs_spawn_thread /root/mariadb/storage/perfschema/pfs.cc:2201:3
|
#24 0x7f3ee7268608 in start_thread /build/glibc-e2p3jK/glibc-2.31/nptl/pthread_create.c:477:8
|
#25 0x7f3ee6f7e352 in clone /build/glibc-e2p3jK/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
|
0x7f3eb5357ca0 is located 0 bytes to the right of 15729824-byte region [0x7f3eb4457800,0x7f3eb5357ca0)
|
allocated by thread T11 here:
|
#0 0x82bdf6 in realloc (/root/bin_original/usr/local/mysql/bin/mariadbd+0x82bdf6)
|
|
Thread T11 created by T0 here:
|
#0 0x8161fc in pthread_create (/root/bin_original/usr/local/mysql/bin/mariadbd+0x8161fc)
|
#1 0x1b26a9d in my_thread_create(unsigned long*, pthread_attr_t const*, void* (*)(void*), void*) /root/mariadb/storage/perfschema/my_thread.h:52:10
|
#2 0x1b26a9d in pfs_spawn_thread_v1 /root/mariadb/storage/perfschema/pfs.cc:2252:15
|
#3 0x871689 in inline_mysql_thread_create(unsigned int, unsigned long*, pthread_attr_t const*, void* (*)(void*), void*) /root/mariadb/include/mysql/psi/mysql_thread.h:1139:11
|
#4 0x871689 in create_thread_to_handle_connection(CONNECT*) /root/mariadb/sql/mysqld.cc:6074:19
|
#5 0x872518 in create_new_thread(CONNECT*) /root/mariadb/sql/mysqld.cc:6136:3
|
#6 0x872518 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /root/mariadb/sql/mysqld.cc:6198:5
|
#7 0x86f988 in handle_connections_sockets() /root/mariadb/sql/mysqld.cc:6311:9
|
#8 0x86714a in mysqld_main(int, char**) /root/mariadb/sql/mysqld.cc:5969:3
|
#9 0x7f3ee6e83082 in __libc_start_main /build/glibc-e2p3jK/glibc-2.31/csu/../csu/libc-start.c:308:16
|
|
SUMMARY: AddressSanitizer: heap-buffer-overflow /root/mariadb/mysys/ma_dyncol.c in dynstr_append_json_quoted
|
Shadow bytes around the buggy address:
|
0x0fe856a62f40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0fe856a62f50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0fe856a62f60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0fe856a62f70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0fe856a62f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
=>0x0fe856a62f90: 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa fa fa
|
0x0fe856a62fa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0fe856a62fb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0fe856a62fc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0fe856a62fd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0fe856a62fe0: 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
|
==574491==ABORTING
|