[MDEV-22130] SHOW WARNINGS will SIGSEGV 10.5 optimized build after setting CHARACTER_SET_RESULTS to NULL and running any invalid SQL | Binary_string::copy_printable_hhhh Created: 2020-04-03  Updated: 2020-05-06  Resolved: 2020-05-06

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 10.5
Fix Version/s: 10.5.3

Type: Bug Priority: Critical
Reporter: Roel Van de Paar Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: not-10.1, not-10.2, not-10.3, not-10.4, regression

Issue Links:
Relates
relates to MDEV-22261 Regular fatal crashes when creating S... Closed

 Description   

SET @@CHARACTER_SET_RESULTS=NULL;
a;
SHOW WARNINGS;

Leads to:

10.5.3 e8351934b68d6d3ee273292eaa2ece203bb2b846

Core was generated by `/data/MD020420-mariadb-10.5.3-linux-x86_64-opt/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 0x7f3885180700 (LWP 13873))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055cf90ac0d47 in my_write_core (sig=sig@entry=11) at /data/10.5_opt/mysys/stacktrace.c:518
#2  0x000055cf9048287a in handle_fatal_signal (sig=11) at /data/10.5_opt/sql/signal_handler.cc:325
#3  <signal handler called>
#4  Binary_string::copy_printable_hhhh (this=this@entry=0x7f388517ec80, to_cs=0x0, from_cs=0x55cf91606400 <my_charset_utf8mb3_general_ci>, from=0x7f38558549c0 "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'a' at line 1", from_length=from_length@entry=149) at /data/10.5_opt/sql/sql_string.cc:788
#5  0x000055cf901d6b14 in Protocol::store_warning (this=this@entry=0x7f3855812558, from=<optimized out>, length=length@entry=149) at /data/10.5_opt/sql/protocol.cc:1199
#6  0x000055cf90253050 in mysqld_show_warnings (thd=thd@entry=0x7f3855812018, levels_to_show=levels_to_show@entry=7) at /data/10.5_opt/sql/sql_error.cc:825
#7  0x000055cf9028df56 in mysql_execute_command (thd=thd@entry=0x7f3855812018) at /data/10.5_opt/sql/sql_parse.cc:3971
#8  0x000055cf90294a6c in mysql_parse (thd=thd@entry=0x7f3855812018, rawbuf=<optimized out>, length=13, parser_state=parser_state@entry=0x7f388517f4d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/10.5_opt/sql/sql_parse.cc:7953
#9  0x000055cf902898e0 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f3855812018, packet=packet@entry=0x7f385583a019 "", packet_length=packet_length@entry=13, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/10.5_opt/sql/sql_parse.cc:1839
#10 0x000055cf90287bff in do_command (thd=0x7f3855812018) at /data/10.5_opt/sql/sql_parse.cc:1358
#11 0x000055cf9037c92e in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7f3882c329b8, put_in_cache=put_in_cache@entry=true) at /data/10.5_opt/sql/sql_connect.cc:1422
#12 0x000055cf9037cad4 in handle_one_connection (arg=arg@entry=0x7f3882c329b8) at /data/10.5_opt/sql/sql_connect.cc:1319
#13 0x000055cf906e89da in pfs_spawn_thread (arg=0x7f3882c4b018) at /data/10.5_opt/storage/perfschema/pfs.cc:2201
#14 0x00007f38845a76db in start_thread (arg=0x7f3885180700) at pthread_create.c:463
#15 0x00007f38839a588f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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

Bug confirmed not present in:
MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (dbg), 10.4.13 (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)



 Comments   
Comment by Roel Van de Paar [ 2020-05-06 ]

Thank you for the fix Bar!

Generated at Thu Feb 08 09:12:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.