Details
Description
SELECT JSON_KEYS(REPEAT('{ "a" : "foo", "b" : [ true,', 100)); |
Compilation command:
CC=clang-12 CXX=clang++-12 cmake ../mariadb -DWITH_ASAN=ON
|
ASAN report:
=================================================================
|
==107603==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000003308f50 at pc 0x0000024c2592 bp 0x7f376610d830 sp 0x7f376610d828 |
READ of size 8 at 0x000003308f50 thread T11 |
#0 0x24c2591 in json_scan_next /root/mariadb/strings/json_lib.c:977:28 |
#1 0x24c2591 in v_true /root/mariadb/strings/json_lib.c:612:10 |
#2 0x24b46e5 in json_scan_next /root/mariadb/strings/json_lib.c:977:28 |
#3 0x109ce91 in Item_func_json_keys::val_str(String*) /root/mariadb/sql/item_jsonfunc.cc:3704:10 |
#4 0x11831a9 in Type_handler::Item_send_str(Item*, Protocol*, st_value*) const /root/mariadb/sql/sql_type.cc:7496:19 |
#5 0x90ea0a in Protocol::send_result_set_row(List<Item>*) /root/mariadb/sql/protocol.cc:1333:15 |
#6 0xa7584c in select_send::send_data(List<Item>&) /root/mariadb/sql/sql_class.cc:3187:17 |
#7 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 |
#8 0xcb3d4d in JOIN::exec_inner() /root/mariadb/sql/sql_select.cc:4862:22 |
#9 0xcb1198 in JOIN::exec() /root/mariadb/sql/sql_select.cc:4774:8 |
#10 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 |
#11 0xc51c68 in handle_select(THD*, LEX*, select_result*, unsigned long long) /root/mariadb/sql/sql_select.cc:630:10 |
#12 0xba71f1 in execute_sqlcom_select(THD*, TABLE_LIST*) /root/mariadb/sql/sql_parse.cc:6094:12 |
#13 0xb95e8b in mysql_execute_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:3943:12 |
#14 0xc22e52 in Prepared_statement::execute(String*, bool) /root/mariadb/sql/sql_prepare.cc:5076:14 |
#15 0xc1c93a in Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) /root/mariadb/sql/sql_prepare.cc:4461:10 |
#16 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 |
#17 0xc1affe in mysqld_stmt_execute(THD*, char*, unsigned int) /root/mariadb/sql/sql_prepare.cc:3139:3 |
#18 0xb81a77 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /root/mariadb/sql/sql_parse.cc:1818:5 |
#19 0xb89c41 in do_command(THD*, bool) /root/mariadb/sql/sql_parse.cc:1406:17 |
#20 0xf82df8 in do_handle_one_connection(CONNECT*, bool) /root/mariadb/sql/sql_connect.cc:1437:11 |
#21 0xf82848 in handle_one_connection /root/mariadb/sql/sql_connect.cc:1339:5 |
#22 0x1b267da in pfs_spawn_thread /root/mariadb/storage/perfschema/pfs.cc:2201:3 |
#23 0x7f378a6ad608 in start_thread /build/glibc-e2p3jK/glibc-2.31/nptl/pthread_create.c:477:8 |
#24 0x7f378a3c3352 in clone /build/glibc-e2p3jK/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 |
|
0x000003308f50 is located 248 bytes to the right of global variable 'vtable for ha_myisammrg' defined in '/root/mariadb/storage/myisammrg/ha_myisammrg.cc' (0x33087c0) of size 1688 |
SUMMARY: AddressSanitizer: global-buffer-overflow /root/mariadb/strings/json_lib.c:977:28 in json_scan_next |
Shadow bytes around the buggy address:
|
0x000080659190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0000806591a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0000806591b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0000806591c0: 00 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9
|
0x0000806591d0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
|
=>0x0000806591e0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9[f9]f9 f9 f9 f9 f9
|
0x0000806591f0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
|
0x000080659200: 00 00 00 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00
|
0x000080659210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x000080659220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x000080659230: 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 |
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
|
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 0x7f378a2c8082 in __libc_start_main /build/glibc-e2p3jK/glibc-2.31/csu/../csu/libc-start.c:308:16 |
|
==107603==ABORTING
|
Attachments
Issue Links
- relates to
-
MDEV-33984 Server crashes at Item_func_json_keys::val_str
- Confirmed