Comment 0 for bug 1884809

Revision history for this message
Lars Tangvald (lars-tangvald) wrote :

Note: This was originally reported as https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/1877504, but that bug contains discussions about multiple separate issues, which are not fully resolved by this fix.

[Impact]

libmysqlclient21 does not by default include any charset files in Ubuntu, but it will use charset files found in /usr/share/mysql/
If the usr/share/mysql/Index.xml file contains a charset definition with a certain combination of collations, it can cause a segmentation fault in libmysqlclient21. The default charset files in MySQL do not cause this problem, but those from MariaDB do. So a user running e.g. mythtv (which is built with libmysqlclient21) with MariaDB as the underlying server package can encounter crashes.

[Test Case]

* Install libmysqlclient21, libmysqlclient-dev and mysql-server
* Connect to the database with "sudo mysql" and run the attached init.sql (just creates a test user with access to a test database)
* Compile attached mysql_test.c (file has full gcc command needed)
* Run the mysql_test program. It will output a few lines (contents of test table)
* Now replace /usr/share/mysql/charsets/Index.xml with the attached one
* Run the mysql_test program. It will produce a segmentation fault

[Regression Potential]

The patch itself only blocks out a single function call on a pointer if that pointer is null, but it doesn't fix the underlying issue of the charset parser picking up unexpected definition files (but this problem is present in versions prior to 8.0.20 as well)