Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
11.3.0
-
None
-
Ubuntu 20.04
Description
Run these queries in release build:
CREATE TABLE x ( x FIXED ) ;
INSERT INTO x ( x ) VALUES ( 1 ) ;
UPDATE x SET x = 1 WHERE ( WITH x AS ( SELECT 1 - 1 AS x ORDER BY x = 1 AND ( x < ( 1 IN ( 1 , 1 ) ) AND x = 1 AND x = 1 AND x = 1 ) DESC , x , x LIMIT 1 ) SELECT CASE CASE ( x NOT BETWEEN 'x' AND 'x' AND x < 1 ) WHEN 'x' THEN 'x' WHEN x ( NULL ) THEN 'x' WHEN 'x' THEN 'x' END WHEN x = 'x' THEN 'x' END , x FROM x UNION SELECT x , x FROM x ) NOT IN ( SELECT x , x FROM x WHERE x < 1 OR ( 1 OR ( 1 IN ( 1 , 1 ) ) OR ( x BETWEEN 1 AND 1 ) AND x < 1 ) ) ;
Will trigger Segmentation fault.
GDB info:
Thread 16 "mariadbd" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe011a700 (LWP 47454)]
Item_cache_str::cache_value (this=0x7fff9c0851c0) at /home/wx/mariadb-11.3.0/sql/item.cc:10525
10525 value_buff.copy(*value);
(gdb) p value
$88 = (String *) 0x0
#0 Item_cache_str::cache_value (this=0x7fff9c0851c0)
at /home/wx/mariadb-11.3.0/sql/item.cc:10525
#1 0x0000555555fefe52 in Item_cache::has_value (this=0x7fff9c0851c0)
at /home/wx/mariadb-11.3.0/sql/item.h:7171
#2 Item_cache_str::val_str (this=0x7fff9c0851c0, str=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/item.cc:10551
#3 0x0000555555ff1e00 in Item_cache_str::cache_value (this=0x7fff9c085ef0)
at /home/wx/mariadb-11.3.0/sql/item.cc:10512
#4 0x0000555555f378e2 in Item_cache::has_value (this=0x7fff9c085ef0)
at /home/wx/mariadb-11.3.0/sql/item.h:7171
#5 Item_cache::is_null (this=0x7fff9c085ef0) at /home/wx/mariadb-11.3.0/sql/item.h:7180
#6 0x0000555555db3dff in merge_key_fields (and_level=3, end=0x7fff9c089790,
new_fields=<optimized out>, start=0x7fff9c089720)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:6372
#7 Item_cond::add_key_fields (this=<optimized out>, join=0x7fff9c085388,
key_fields=0x7fffe0118358, and_level=<optimized out>, usable_tables=18446744073709551615,
sargables=0x7fffe01183c8) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:6775
#8 0x0000555555da80b5 in Item_func_trig_cond::add_key_fields (sargables=0x7fffe01183c8,
usable_tables=18446744073709551615, and_level=0x7fffe0118354, key_fields=0x7fffe0118358,
join=<optimized out>, this=0x7fff9c0885e0)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:6797
#9 Item_func_trig_cond::add_key_fields (this=0x7fff9c0885e0, join=<optimized out>,
key_fields=0x7fffe0118358, and_level=0x7fffe0118354, usable_tables=18446744073709551615,
sargables=0x7fffe01183c8) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:6782
#10 0x0000555555da80b5 in Item_func_trig_cond::add_key_fields (sargables=0x7fffe01183c8,
usable_tables=18446744073709551615, and_level=0x7fffe0118354, key_fields=0x7fffe0118358,
join=<optimized out>, this=0x7fff9c088760)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:6797
#11 Item_func_trig_cond::add_key_fields (this=0x7fff9c088760, join=<optimized out>,
key_fields=0x7fffe0118358, and_level=0x7fffe0118354, usable_tables=18446744073709551615,
sargables=0x7fffe01183c8) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:6782
#12 0x0000555555db3ac2 in Item_cond_and::add_key_fields (this=<optimized out>,
join=0x7fff9c085388, key_fields=0x7fffe0118358, and_level=0x7fffe0118354,
usable_tables=<optimized out>, sargables=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:6750
#13 0x0000555555db4c5a in update_ref_and_keys (thd=0x7fff9c000c58,
keyuse=keyuse@entry=0x7fffe01183d0, join_tab=0x7fff9c086eb8, tables=1,
cond=0x7fff9c089440, normal_tables=18446744073709551615, sargables=0x7fffe01183c8,
select_lex=<optimized out>, select_lex=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:7432
#14 0x0000555555de73a8 in JOIN::reoptimize (this=this@entry=0x7fff9c085388,
added_where=<optimized out>, join_tables=join_tables@entry=1, save_to=save_to@entry=0x0)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:31400
#15 0x0000555555ee055a in JOIN::choose_subquery_plan (this=this@entry=0x7fff9c085388,
join_tables=1) at /home/wx/mariadb-11.3.0/sql/opt_subselect.cc:6957
#16 0x0000555555def89a in make_join_statistics (keyuse_array=0x7fff9c0856e8, tables_list=...,
join=0x7fff9c085388) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:6222
#17 JOIN::optimize_inner (this=this@entry=0x7fff9c085388)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:2624
#18 0x0000555555defccd in JOIN::optimize (this=this@entry=0x7fff9c085388)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:1944
#19 0x0000555555d4db06 in st_select_lex::optimize_unflattened_subqueries (
this=0x7fff9c005720, const_only=const_only@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4916
#20 0x0000555555ede8ae in JOIN::optimize_constant_subqueries (this=this@entry=0x7fff9c07e4e0)
at /home/wx/mariadb-11.3.0/sql/opt_subselect.cc:5898
#21 0x0000555555dec36d in JOIN::optimize_inner (this=this@entry=0x7fff9c07e4e0)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:2274
#22 0x0000555555defccd in JOIN::optimize (this=this@entry=0x7fff9c07e4e0)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:1944
#23 0x0000555555df1e4e in Sql_cmd_dml::execute_inner (this=this@entry=0x7fff9c013968,
thd=thd@entry=0x7fff9c000c58) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:33401
#24 0x0000555555e54ff7 in Sql_cmd_update::execute_inner (this=0x7fff9c013968,
thd=0x7fff9c000c58) at /home/wx/mariadb-11.3.0/sql/sql_update.cc:3069
#25 0x0000555555dab46b in Sql_cmd_dml::execute (this=0x7fff9c013968, thd=0x7fff9c000c58)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:33350
#26 0x0000555555d7920d in mysql_execute_command (thd=thd@entry=0x7fff9c000c58,
is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:4361
#27 0x0000555555d68c27 in mysql_parse (thd=0x7fff9c000c58, rawbuf=<optimized out>,
length=<optimized out>, parser_state=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:7734
#28 0x0000555555d74fdd in dispatch_command (command=command@entry=COM_QUERY,
thd=thd@entry=0x7fff9c000c58,
packet=packet@entry=0x7fff9c008509 "UPDATE x SET x = 1 WHERE ( WITH x AS ( SELECT 1 - 1 AS x ORDER BY x = 1 AND ( x < ( 1 IN ( 1 , 1 ) ) AND x = 1 AND x = 1 AND x = 1 ) DESC , x , x LIMIT 1 ) SELECT CASE CASE ( x NOT BETWEEN 'x' AND 'x'"...,
packet_length=packet_length@entry=451, blocking=blocking@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_class.h:251
#29 0x0000555555d7721e in do_command (thd=0x7fff9c000c58, blocking=blocking@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:1406
#30 0x0000555555e9a617 in do_handle_one_connection (connect=<optimized out>,
connect@entry=0x555557e16a18, put_in_cache=put_in_cache@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1445
#31 0x0000555555e9a94d in handle_one_connection (arg=arg@entry=0x555557e16a18)
at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1347
#32 0x00005555561e658d in pfs_spawn_thread (arg=0x555557dc0508)
at /home/wx/mariadb-11.3.0/storage/perfschema/pfs.cc:2201
#33 0x00007ffff7b48609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#34 0x00007ffff7719133 in clone () from /lib/x86_64-linux-gnu/libc.so.6
Attachments
Issue Links
- duplicates
-
MDEV-29093 Assertion `0' failed in Item_type_holder::val_str on UPDATE and SIGSEGV in String::copy, UBSAN: reference binding to null pointer of type 'const struct String'
- Closed