Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
N/A
-
None
Description
CREATE OR REPLACE TABLE t1 (a INT); |
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; |
|
SET system_versioning_alter_history=KEEP; |
ALTER TABLE t1 ADD SYSTEM VERSIONING; |
|
CREATE OR REPLACE PROCEDURE pr() CREATE OR REPLACE TABLE tmp AS SELECT non_existing_column FROM v1; |
--error ER_BAD_FIELD_ERROR
|
CALL pr();
|
ALTER TABLE t1 FORCE; |
--error ER_BAD_FIELD_ERROR
|
CALL pr();
|
|
# Cleanup
|
DROP PROCEDURE pr; |
DROP VIEW v1; |
DROP TABLE t1; |
Normal debug build produces a wrong error code on the 2nd procedure call:
bb-10.3-temporal ea49441c41 |
MariaDB [test]> CALL pr();
|
ERROR 1054 (42S22): Unknown column 'non_existing_column' in 'field list' |
MariaDB [test]> ALTER TABLE t1 FORCE; |
Query OK, 0 rows affected (0.66 sec) |
Records: 0 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> CALL pr();
|
ERROR 1356 (HY000): View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them |
If I drop the objects and try the same again in the same session, then already the 1st procedure call fails with ERROR 1356. If I reconnect and try again, the behavior is as above. I suspect it might be non-deterministic.
The failure on an ASAN build seems to be reliable:
bb-10.3-temporal ea49441c41 with ASAN |
==9636==ERROR: AddressSanitizer: heap-use-after-free on address 0x61900009a2a9 at pc 0x558d0c1b9cad bp 0x7fdc6648a9d0 sp 0x7fdc6648a9c8
|
READ of size 1 at 0x61900009a2a9 thread T5
|
#0 0x558d0c1b9cac in my_strcasecmp_utf8 /data/src/bb-10.3-temporal/strings/ctype-utf8.c:5302
|
#1 0x558d0a7545c4 in find_field_in_table(THD*, TABLE*, char const*, unsigned int, bool, unsigned int*) /data/src/bb-10.3-temporal/sql/sql_base.cc:5503
|
#2 0x558d0a7567ee in find_field_in_tables(THD*, Item_ident*, TABLE_LIST*, TABLE_LIST*, Item**, find_item_error_report_type, bool, bool) /data/src/bb-10.3-temporal/sql/sql_base.cc:5886
|
#3 0x558d0afda5fc in Item_field::fix_fields(THD*, Item**) /data/src/bb-10.3-temporal/sql/item.cc:6071
|
#4 0x558d0b096263 in Item_func::fix_fields(THD*, Item**) /data/src/bb-10.3-temporal/sql/item_func.cc:361
|
#5 0x558d0b03ffff in Item_cond::fix_fields(THD*, Item**) /data/src/bb-10.3-temporal/sql/item_cmpfunc.cc:4593
|
#6 0x558d0a7631e5 in setup_conds(THD*, TABLE_LIST*, List<TABLE_LIST>&, Item**) /data/src/bb-10.3-temporal/sql/sql_base.cc:7954
|
#7 0x558d0a913cdc in setup_without_group /data/src/bb-10.3-temporal/sql/sql_select.cc:646
|
#8 0x558d0a9199f1 in JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /data/src/bb-10.3-temporal/sql/sql_select.cc:1244
|
#9 0x558d0aad6d25 in st_select_lex_unit::prepare_join(THD*, st_select_lex*, select_result*, unsigned long, bool) /data/src/bb-10.3-temporal/sql/sql_union.cc:674
|
#10 0x558d0aad97a9 in st_select_lex_unit::prepare(THD*, select_result*, unsigned long) /data/src/bb-10.3-temporal/sql/sql_union.cc:946
|
#11 0x558d0a7e7dc6 in mysql_derived_prepare(THD*, LEX*, TABLE_LIST*) /data/src/bb-10.3-temporal/sql/sql_derived.cc:865
|
#12 0x558d0a7e4456 in mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) /data/src/bb-10.3-temporal/sql/sql_derived.cc:197
|
#13 0x558d0ab4c164 in TABLE_LIST::handle_derived(LEX*, unsigned int) /data/src/bb-10.3-temporal/sql/table.cc:8081
|
#14 0x558d0a84214e in st_select_lex::handle_derived(LEX*, unsigned int) /data/src/bb-10.3-temporal/sql/sql_lex.cc:4036
|
#15 0x558d0a9187e6 in JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*) /data/src/bb-10.3-temporal/sql/sql_select.cc:1133
|
#16 0x558d0a936f29 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/bb-10.3-temporal/sql/sql_select.cc:4236
|
#17 0x558d0a911f6c in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/bb-10.3-temporal/sql/sql_select.cc:382
|
#18 0x558d0a883f0e in mysql_execute_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:4220
|
#19 0x558d0b34bf03 in sp_instr_stmt::exec_core(THD*, unsigned int*) /data/src/bb-10.3-temporal/sql/sp_head.cc:3407
|
#20 0x558d0b34a751 in sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) /data/src/bb-10.3-temporal/sql/sp_head.cc:3123
|
#21 0x558d0b34b656 in sp_instr_stmt::execute(THD*, unsigned int*) /data/src/bb-10.3-temporal/sql/sp_head.cc:3310
|
#22 0x558d0b33ef42 in sp_head::execute(THD*, bool) /data/src/bb-10.3-temporal/sql/sp_head.cc:1220
|
#23 0x558d0b343c55 in sp_head::execute_procedure(THD*, List<Item>*) /data/src/bb-10.3-temporal/sql/sp_head.cc:2101
|
#24 0x558d0a87c6a8 in do_execute_sp /data/src/bb-10.3-temporal/sql/sql_parse.cc:2919
|
#25 0x558d0a87e147 in Sql_cmd_call::execute(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:3161
|
#26 0x558d0a891c06 in mysql_execute_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:6261
|
#27 0x558d0a89c143 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:7991
|
#28 0x558d0a876866 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1825
|
#29 0x558d0a8738c7 in do_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1370
|
#30 0x558d0abeb664 in do_handle_one_connection(CONNECT*) /data/src/bb-10.3-temporal/sql/sql_connect.cc:1420
|
#31 0x558d0abeb079 in handle_one_connection /data/src/bb-10.3-temporal/sql/sql_connect.cc:1326
|
#32 0x558d0b722230 in pfs_spawn_thread /data/src/bb-10.3-temporal/storage/perfschema/pfs.cc:1863
|
#33 0x7fdc7299d493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
|
#34 0x7fdc70d8393e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
|
|
0x61900009a2a9 is located 297 bytes inside of 1100-byte region [0x61900009a180,0x61900009a5cc)
|
freed by thread T5 here:
|
#0 0x7fdc72c07527 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x54527)
|
#1 0x558d0c123957 in free_memory /data/src/bb-10.3-temporal/mysys/safemalloc.c:279
|
#2 0x558d0c122fb8 in sf_free /data/src/bb-10.3-temporal/mysys/safemalloc.c:197
|
#3 0x558d0c0f1baf in my_free /data/src/bb-10.3-temporal/mysys/my_malloc.c:217
|
#4 0x558d0c0d20b8 in free_root /data/src/bb-10.3-temporal/mysys/my_alloc.c:414
|
#5 0x558d0ab119a7 in TABLE_SHARE::destroy() /data/src/bb-10.3-temporal/sql/table.cc:473
|
#6 0x558d0ab11ba7 in free_table_share(TABLE_SHARE*) /data/src/bb-10.3-temporal/sql/table.cc:489
|
#7 0x558d0ad87f78 in tdc_delete_share_from_hash /data/src/bb-10.3-temporal/sql/table_cache.cc:546
|
#8 0x558d0ad8b309 in tdc_release_share(TABLE_SHARE*) /data/src/bb-10.3-temporal/sql/table_cache.cc:993
|
#9 0x558d0ad8601f in intern_close_table /data/src/bb-10.3-temporal/sql/table_cache.cc:223
|
#10 0x558d0ad86255 in tc_remove_table /data/src/bb-10.3-temporal/sql/table_cache.cc:260
|
#11 0x558d0ad873c6 in tc_release_table(TABLE*) /data/src/bb-10.3-temporal/sql/table_cache.cc:472
|
#12 0x558d0a73e1a8 in close_thread_table(THD*, TABLE**) /data/src/bb-10.3-temporal/sql/sql_base.cc:906
|
#13 0x558d0a73cc3d in close_all_tables_for_name(THD*, TABLE_SHARE*, ha_extra_function, TABLE*) /data/src/bb-10.3-temporal/sql/sql_base.cc:674
|
#14 0x558d0aaab2bc in mysql_alter_table(THD*, char const*, char const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool) /data/src/bb-10.3-temporal/sql/sql_table.cc:9895
|
#15 0x558d0abf9c24 in Sql_cmd_alter_table::execute(THD*) /data/src/bb-10.3-temporal/sql/sql_alter.cc:331
|
#16 0x558d0a891c06 in mysql_execute_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:6261
|
#17 0x558d0a89c143 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:7991
|
#18 0x558d0a876866 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1825
|
#19 0x558d0a8738c7 in do_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1370
|
#20 0x558d0abeb664 in do_handle_one_connection(CONNECT*) /data/src/bb-10.3-temporal/sql/sql_connect.cc:1420
|
#21 0x558d0abeb079 in handle_one_connection /data/src/bb-10.3-temporal/sql/sql_connect.cc:1326
|
#22 0x558d0b722230 in pfs_spawn_thread /data/src/bb-10.3-temporal/storage/perfschema/pfs.cc:1863
|
#23 0x7fdc7299d493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
|
|
previously allocated by thread T5 here:
|
#0 0x7fdc72c0773f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
|
#1 0x558d0c12275a in sf_malloc /data/src/bb-10.3-temporal/mysys/safemalloc.c:118
|
#2 0x558d0c0f129d in my_malloc /data/src/bb-10.3-temporal/mysys/my_malloc.c:101
|
#3 0x558d0c0d1117 in alloc_root /data/src/bb-10.3-temporal/mysys/my_alloc.c:243
|
#4 0x558d0c0d286e in memdup_root /data/src/bb-10.3-temporal/mysys/my_alloc.c:477
|
#5 0x558d0ab16ff4 in TABLE_SHARE::init_from_binary_frm_image(THD*, bool, unsigned char const*, unsigned long) /data/src/bb-10.3-temporal/sql/table.cc:1266
|
#6 0x558d0ab127c3 in open_table_def(THD*, TABLE_SHARE*, unsigned int) /data/src/bb-10.3-temporal/sql/table.cc:669
|
#7 0x558d0ad89aa5 in tdc_acquire_share(THD*, TABLE_LIST*, unsigned int, TABLE**) /data/src/bb-10.3-temporal/sql/table_cache.cc:837
|
#8 0x558d0a741815 in open_table(THD*, TABLE_LIST*, Open_table_context*) /data/src/bb-10.3-temporal/sql/sql_base.cc:1768
|
#9 0x558d0a7493b9 in open_and_process_table /data/src/bb-10.3-temporal/sql/sql_base.cc:3467
|
#10 0x558d0a74bc9f in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /data/src/bb-10.3-temporal/sql/sql_base.cc:3987
|
#11 0x558d0a74fc0b in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /data/src/bb-10.3-temporal/sql/sql_base.cc:4742
|
#12 0x558d0a8abf1d in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int) /data/src/bb-10.3-temporal/sql/sql_base.h:487
|
#13 0x558d0a883b49 in mysql_execute_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:4168
|
#14 0x558d0b34bf03 in sp_instr_stmt::exec_core(THD*, unsigned int*) /data/src/bb-10.3-temporal/sql/sp_head.cc:3407
|
#15 0x558d0b34a751 in sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) /data/src/bb-10.3-temporal/sql/sp_head.cc:3123
|
#16 0x558d0b34b656 in sp_instr_stmt::execute(THD*, unsigned int*) /data/src/bb-10.3-temporal/sql/sp_head.cc:3310
|
#17 0x558d0b33ef42 in sp_head::execute(THD*, bool) /data/src/bb-10.3-temporal/sql/sp_head.cc:1220
|
#18 0x558d0b343c55 in sp_head::execute_procedure(THD*, List<Item>*) /data/src/bb-10.3-temporal/sql/sp_head.cc:2101
|
#19 0x558d0a87c6a8 in do_execute_sp /data/src/bb-10.3-temporal/sql/sql_parse.cc:2919
|
#20 0x558d0a87e147 in Sql_cmd_call::execute(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:3161
|
#21 0x558d0a891c06 in mysql_execute_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:6261
|
#22 0x558d0a89c143 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:7991
|
#23 0x558d0a876866 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1825
|
#24 0x558d0a8738c7 in do_command(THD*) /data/src/bb-10.3-temporal/sql/sql_parse.cc:1370
|
#25 0x558d0abeb664 in do_handle_one_connection(CONNECT*) /data/src/bb-10.3-temporal/sql/sql_connect.cc:1420
|
#26 0x558d0abeb079 in handle_one_connection /data/src/bb-10.3-temporal/sql/sql_connect.cc:1326
|
#27 0x558d0b722230 in pfs_spawn_thread /data/src/bb-10.3-temporal/storage/perfschema/pfs.cc:1863
|
#28 0x7fdc7299d493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
|
|
Thread T5 created by T0 here:
|
#0 0x7fdc72bd6bba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
|
#1 0x558d0b7227f8 in spawn_thread_v1 /data/src/bb-10.3-temporal/storage/perfschema/pfs.cc:1913
|
#2 0x558d0a63df0f in inline_mysql_thread_create /data/src/bb-10.3-temporal/include/mysql/psi/mysql_thread.h:1239
|
#3 0x558d0a653cef in create_thread_to_handle_connection(CONNECT*) /data/src/bb-10.3-temporal/sql/mysqld.cc:6574
|
#4 0x558d0a6543f4 in create_new_thread /data/src/bb-10.3-temporal/sql/mysqld.cc:6644
|
#5 0x558d0a655405 in handle_connections_sockets() /data/src/bb-10.3-temporal/sql/mysqld.cc:6919
|
#6 0x558d0a653180 in mysqld_main(int, char**) /data/src/bb-10.3-temporal/sql/mysqld.cc:6192
|
#7 0x558d0a63c43f in main /data/src/bb-10.3-temporal/sql/main.cc:25
|
#8 0x7fdc70cbb2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
|
|
SUMMARY: AddressSanitizer: heap-use-after-free /data/src/bb-10.3-temporal/strings/ctype-utf8.c:5302 my_strcasecmp_utf8
|
Shadow bytes around the buggy address:
|
0x0c328000b400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000b410: fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa
|
0x0c328000b420: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0c328000b430: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000b440: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
=>0x0c328000b450: fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd
|
0x0c328000b460: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000b470: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000b480: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000b490: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
0x0c328000b4a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
|
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
|
==9636==ABORTING
|
Reproducible with (at least) MyISAM, InnoDB, Aria.