[MDEV-31930] Server crashes when executing PS (with SELECT VIEW statement) twice after enabling variable aria_encrypt_tables Created: 2023-08-16  Updated: 2023-08-16

Status: Open
Project: MariaDB Server
Component/s: Prepared Statements
Affects Version/s: 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Ramesh Sivaraman Assignee: Dmitry Shulga
Resolution: Unresolved Votes: 0
Labels: None


 Description   

CREATE VIEW c AS SELECT * FROM information_schema.VIEWS;
SET GLOBAL aria_encrypt_tables=1;
PREPARE s FROM 'SELECT * FROM c';
EXECUTE s;
EXECUTE s;

Leads to:

10.4.31 161ce045a71e306768d4609bdc35788fa5ea2a71 (Debug)

Core was generated by `/test/MD090823-mariadb-10.4.31-linux-x86_64-dbg/bin/mariadbd --no-defaults --co'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055869ebb7faa in TABLE_LIST::get_tablenr (this=0x14d1e4022ec0)
    at /test/10.4_dbg/sql/sql_lex.cc:4990
 
warning: Source file is more recent than executable.
4990	      table->maybe_null_exec= 0;
[Current thread is 1 (Thread 0x14d234fc8700 (LWP 1297147))]
(gdb) bt
#0  0x000055869ebb7faa in TABLE_LIST::get_tablenr (this=0x14d1e4022ec0) at /test/10.4_dbg/sql/sql_lex.cc:4990
#1  st_select_lex::save_leaf_tables (this=0x14d1e40228b0, thd=0x14d1e4000d28) at /test/10.4_dbg/sql/sql_lex.cc:4987
#2  0x000055869ec56c71 in JOIN::optimize_inner (this=this@entry=0x14d1e4013410) at /test/10.4_dbg/sql/sql_select.cc:2033
#3  0x000055869ec58008 in JOIN::optimize (this=this@entry=0x14d1e4013410) at /test/10.4_dbg/sql/sql_select.cc:1711
#4  0x000055869ec58930 in mysql_select (thd=thd@entry=0x14d1e4000d28, tables=0x14d1e4022ec0, wild_num=0, fields=@0x14d1e4022a10: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14d1e4022e78, last = 0x14d1e402aaf8, elements = 11}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x14d1e4023e18, unit=0x14d1e4020d58, select_lex=0x14d1e40228b0) at /test/10.4_dbg/sql/sql_select.cc:4812
#5  0x000055869ec58c26 in handle_select (thd=thd@entry=0x14d1e4000d28, lex=lex@entry=0x14d1e4020c98, result=result@entry=0x14d1e4023e18, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.4_dbg/sql/sql_select.cc:442
#6  0x000055869ebd4df1 in execute_sqlcom_select (thd=thd@entry=0x14d1e4000d28, all_tables=0x14d1e4022ec0) at /test/10.4_dbg/sql/sql_parse.cc:6473
#7  0x000055869ebdecb1 in mysql_execute_command (thd=0x14d1e4000d28) at /test/10.4_dbg/sql/sql_parse.cc:3976
#8  0x000055869ebff645 in Prepared_statement::execute (this=this@entry=0x14d1e402c868, expanded_query=expanded_query@entry=0x14d234fc5a10, open_cursor=open_cursor@entry=false) at /test/10.4_dbg/sql/sql_prepare.cc:5024
#9  0x000055869ebff9b9 in Prepared_statement::execute_loop (this=this@entry=0x14d1e402c868, expanded_query=expanded_query@entry=0x14d234fc5a10, open_cursor=open_cursor@entry=false, packet=packet@entry=0x0, packet_end=packet_end@entry=0x0) at /test/10.4_dbg/sql/sql_prepare.cc:4493
#10 0x000055869ec0000d in mysql_sql_stmt_execute (thd=thd@entry=0x14d1e4000d28) at /test/10.4_dbg/sql/sql_prepare.cc:3577
#11 0x000055869ebded11 in mysql_execute_command (thd=thd@entry=0x14d1e4000d28) at /test/10.4_dbg/sql/sql_parse.cc:3992
#12 0x000055869ebe9122 in mysql_parse (thd=thd@entry=0x14d1e4000d28, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14d234fc73b0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:8010
#13 0x000055869ebebc3d in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14d1e4000d28, packet=packet@entry=0x14d1e4019509 "EXECUTE s", packet_length=packet_length@entry=9, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_class.h:1231
#14 0x000055869ebee468 in do_command (thd=0x14d1e4000d28) at /test/10.4_dbg/sql/sql_parse.cc:1378
#15 0x000055869ed0b1ef in do_handle_one_connection (connect=<optimized out>) at /test/10.4_dbg/sql/sql_connect.cc:1420
#16 0x000055869ed0b2ab in handle_one_connection (arg=<optimized out>) at /test/10.4_dbg/sql/sql_connect.cc:1324
#17 0x000014d24ffa5609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#18 0x000014d24fb91133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.31 (dbg), 10.4.31 (opt)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.5.22 (dbg), 10.5.22 (opt), 10.6.15 (opt), 10.6.15 (dbg), 10.9.8 (dbg), 10.9.8 (opt), 10.10.6 (dbg), 10.10.6 (opt), 10.11.5 (dbg), 10.11.5 (opt), 11.0.3 (dbg), 11.0.3 (opt), 11.1.2 (dbg), 11.1.2 (opt), 11.2.0 (dbg), 11.2.0 (opt)


Generated at Thu Feb 08 10:27:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.