Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.11, 11.1(EOL), 11.2(EOL), 11.4, 11.8, 12.0
Description
USE test;
|
SET SQL_MODE='';
|
CREATE FUNCTION f(z INT) RETURNS INT READS SQL DATA RETURN (SELECT x FROM t WHERE x = z);
|
CREATE TEMPORARY TABLE t (c INT) ENGINE=InnoDB;
|
SELECT f('a');
|
DROP TEMPORARY TABLES t;
|
SHOW FUNCTION CODE f;
|
Leads to:
10.5.5 30e7a0a866dce530d8328c6d614e48d39a264f9b |
Core was generated by `/test/MD140720-mariadb-10.5.5-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
|
Program terminated with signal SIGSEGV, Segmentation fault.
|
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
|
at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
[Current thread is 1 (Thread 0x153fb7541700 (LWP 1691430))]
|
(gdb) bt
|
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
#1 0x000056063413d4d7 in my_write_core (sig=sig@entry=11) at /test/10.5_dbg/mysys/stacktrace.c:518
|
#2 0x00005606338f79ba in handle_fatal_signal (sig=11) at /test/10.5_dbg/sql/signal_handler.cc:330
|
#3 <signal handler called>
|
#4 TABLE_LIST::print (this=0x153f92c90568, thd=thd@entry=0x153f92c15088, eliminated_tables=eliminated_tables@entry=0, str=str@entry=0x153fb753f2a0, query_type=query_type@entry=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /test/10.5_dbg/sql/sql_select.cc:27553
|
#5 0x00005606336a8876 in print_table_array (query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF, end=0x153f92c742e8, table=0x153f92c742e0, str=0x153fb753f2a0, eliminated_tables=0, thd=0x153f92c15088) at /test/10.5_dbg/sql/sql_select.cc:27243
|
#6 print_join (thd=thd@entry=0x153f92c15088, eliminated_tables=0, str=str@entry=0x153fb753f2a0, tables=0x153f92c90130, query_type=query_type@entry=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /test/10.5_dbg/sql/sql_select.cc:27399
|
#7 0x00005606336a8e23 in st_select_lex::print (this=0x153f92c8ff68, thd=thd@entry=0x153f92c15088, str=str@entry=0x153fb753f2a0, query_type=query_type@entry=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /test/10.5_dbg/sql/sql_select.cc:27699
|
#8 0x00005606339e4696 in subselect_single_select_engine::print (this=0x153f92c91030, str=0x153fb753f2a0, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /test/10.5_dbg/sql/item_subselect.cc:4478
|
#9 0x00005606339e4c03 in Item_subselect::print (this=0x153f92c90e88, str=0x153fb753f2a0, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF) at /test/10.5_dbg/sql/item_subselect.cc:1038
|
#10 0x000056063357fd83 in sp_instr_freturn::print (this=0x153f92c8dea0, str=0x153fb753f2a0) at /test/10.5_dbg/sql/sp_head.cc:4203
|
#11 0x000056063358a50e in sp_head::show_routine_code (this=0x153f92c8f0a0, thd=thd@entry=0x153f92c15088) at /test/10.5_dbg/sql/sp_head.cc:3385
|
#12 0x00005606336505e5 in mysql_execute_command (thd=thd@entry=0x153f92c15088) at /test/10.5_dbg/sql/sql_parse.cc:5728
|
#13 0x0000560633658752 in mysql_parse (thd=thd@entry=0x153f92c15088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x153fb7540350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7993
|
#14 0x0000560633645204 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x153f92c15088, packet=packet@entry=0x153f92c67089 "", packet_length=packet_length@entry=20, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1866
|
#15 0x00005606336439de in do_command (thd=0x153f92c15088) at /test/10.5_dbg/sql/sql_parse.cc:1347
|
#16 0x000056063379fc3b in do_handle_one_connection (connect=<optimized out>, connect@entry=0x153f964c7808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
|
#17 0x00005606337a0357 in handle_one_connection (arg=arg@entry=0x153f964c7808) at /test/10.5_dbg/sql/sql_connect.cc:1313
|
#18 0x0000560633c03ca8 in pfs_spawn_thread (arg=0x153fb4446508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
|
#19 0x0000153fb64ba6db in start_thread (arg=0x153fb7541700) at pthread_create.c:463
|
#20 0x0000153fb58b8a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Bug confirmed present in:
MariaDB: 10.3.24 (dbg), 10.4.15 (dbg), 10.5.5 (dbg)
Bug confirmed not present in:
MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (opt), 10.4.14 (dbg), 10.4.14 (opt), 10.5.5 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)
Attachments
Issue Links
- relates to
-
MDEV-25784 Server crashes in Table_function_json_table::print upon SHOW FUNCTION CODE/SHOW CREATE VIEW, UBSAN: member access within null pointer
-
- Confirmed
-
Additional SIGSEGV in TABLE::versioned with this testcase:
Leads to:
CS 11.4.6 ef966af801afc2a07222b5df65dddd52c77431dd (Debug) Build 15/02/2025
Core was generated by `/test/MD150225-mariadb-11.4.6-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000055b873b6666f in TABLE::versioned (this=0x14df50027e08)at /test/11.4_dbg/sql/table.h:1828
1828 return s->versioned;
[Current thread is 1 (LWP 1955430)]
(gdb) bt
#0 0x000055b873b6666f in TABLE::versioned (this=0x14df50027e08)at /test/11.4_dbg/sql/table.h:1828
#1 0x000055b873cc30d8 in TABLE_LIST::print (this=0x14df500261c8, thd=0x14df50000d58, eliminated_tables=0, str=0x14dfa1d45a50, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF)at /test/11.4_dbg/sql/sql_select.cc:31698
#2 0x000055b873cd1acc in print_table_array (thd=0x14df50000d58, eliminated_tables=0, str=0x14dfa1d45a50, table=0x14df50019ce0, end=0x14df50019ce8, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF)at /test/11.4_dbg/sql/sql_select.cc:31380
#3 0x000055b873cc36e9 in print_join (thd=0x14df50000d58, eliminated_tables=0, str=0x14dfa1d45a50, tables=0x14df50025de8, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF)at /test/11.4_dbg/sql/sql_select.cc:31536
#4 0x000055b873cc45ff in st_select_lex::print (this=0x14df50025c30, thd=0x14df50000d58, str=0x14dfa1d45a50, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF)at /test/11.4_dbg/sql/sql_select.cc:32049
#5 0x000055b874159b8c in subselect_single_select_engine::print (this=0x14df50026a88, str=0x14dfa1d45a50, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF)at /test/11.4_dbg/sql/item_subselect.cc:4713
#6 0x000055b87414a03d in Item_subselect::print (this=0x14df500268f8, str=0x14dfa1d45a50, query_type=QT_ITEM_ORIGINAL_FUNC_NULLIF)at /test/11.4_dbg/sql/item_subselect.cc:1086
#7 0x000055b873eb9b21 in sp_instr_freturn::print (this=0x14df50026b28, str=0x14dfa1d45a50) at /test/11.4_dbg/sql/sp_instr.cc:1508
#8 0x000055b873b05426 in sp_head::show_routine_code (this=0x14df50024cc0, thd=0x14df50000d58) at /test/11.4_dbg/sql/sp_head.cc:3440
#9 0x000055b873c1475f in mysql_execute_command (thd=0x14df50000d58, is_called_from_prepared_stmt=false) at /test/11.4_dbg/sql/sql_parse.cc:5655
#10 0x000055b873c047a4 in mysql_parse (thd=0x14df50000d58, rawbuf=0x14df50019ac0 "SHOW FUNCTION CODE f2", length=21, parser_state=0x14dfa1d47a30) at /test/11.4_dbg/sql/sql_parse.cc:7907
#11 0x000055b873c01c54 in dispatch_command (command=COM_QUERY, thd=0x14df50000d58, packet=0x14df5000afd9 "", packet_length=21, blocking=true) at /test/11.4_dbg/sql/sql_parse.cc:1904
#12 0x000055b873c05353 in do_command (thd=0x14df50000d58, blocking=true)at /test/11.4_dbg/sql/sql_parse.cc:1417
#13 0x000055b873de75a9 in do_handle_one_connection (connect=0x55b878273c68, put_in_cache=true) at /test/11.4_dbg/sql/sql_connect.cc:1408
#14 0x000055b873de7342 in handle_one_connection (arg=0x55b8783440d8)at /test/11.4_dbg/sql/sql_connect.cc:1320
#15 0x000014dfa909ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
#16 0x000014dfa9129c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
Bug confirmed present in:
MariaDB: 10.5.29 (dbg), 10.6.22 (dbg), 10.11.12 (dbg), 11.4.6 (dbg), 11.8.1 (dbg), 12.0.0 (dbg)
Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.5.29 (opt), 10.6.22 (opt), 10.11.12 (opt), 11.4.6 (opt), 11.8.1 (opt), 12.0.0 (opt)
This testcase also produces the previously seen ASAN heap-use-after-free:
ASAN|heap-use-after-free|sql/table.h|TABLE::versioned|TABLE_LIST::print|print_table_array|print_join