[MDEV-24879] Client crash on undefined charsetsdir Created: 2021-02-16  Updated: 2021-03-24  Resolved: 2021-03-24

Status: Closed
Project: MariaDB Server
Component/s: Character Sets, Scripts & Clients
Affects Version/s: 10.5.8
Fix Version/s: 10.2.38, 10.3.29, 10.4.19, 10.5.10

Type: Bug Priority: Minor
Reporter: Michael Joost Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

Linux, likely any



 Description   

bash-5.1# mariadb --default-character-set=ascii -u dbadmin -p asterisk
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 429
Server version: 10.5.8-MariaDB Source distribution
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [asterisk]> select * from blacklist;
Segmentation fault

Location of segfault:
---------------------
in find_command (name=0x5555559e80c0 "select * from blacklist;") at /sources/mariadb-10.5.8/client/mysql.cc:2207
due to Nullptr in charset_info

Expected behavior:
-----------------
Sensible error message, about missing character-sets-dir vs. requested charset

Workaround:
-----------
Specify option character-sets-dir on commandline or in (client) config file

[client]
character-sets-dir=/usr/share/mysql/charsets



 Comments   
Comment by Sergei Golubchik [ 2021-02-17 ]

I cannot repeat that, there is no crash for me, charset_info isn't NULL, because ascii is a compiled-in charset, so it does not need any character-sets-dir.

How did you compile?

Comment by Michael Joost [ 2021-02-18 ]

This was compiled from unmodified sources. According to hints found at BLFS, compile option -DWITH_EXTRA_CHARSETS=complex was used.
There seems to exist no further documentation on that option, but apparently that mode incorporates built-in latin1, latin2, etc., but not ascii (see mariadb-10.5.8/cmake/character_sets.cmake).
To reproduce the segfault, it is of course necessary that the specified or default of character-sets-dir does not exist, eg. like running the client from a different environment than compiled to.

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