Bug #93276 Crash when calling mysql_real_connect() in loop
Submitted: 21 Nov 2018 13:55 Modified: 17 Dec 2018 19:27
Reporter: Reggie Burnett Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S2 (Serious)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[21 Nov 2018 13:55] Reggie Burnett
Description:
Hi! See the attached test program. It calls in loop following sequence:

mysql_library_init(), mysql_init(), mysql_real_connect(), mysql_close(), mysql_library_end()

It is working fine for MySQL versions below 8.0.4. Since 8.0.4 it
crashes at second loop iteration in function mysql_real_connect().

I guess that problem is somewhere in mysql_library_end() or in
mysql_library_init() which free or initialize some global structures.

As there is no crash in version 8.0.3 and below, that problem must have
been introduced in MySQL version 8.0.4 and is present also in 8.0.11,
8.0.12 and 8.0.13 version.

I do not know if you are correct person for contacting about this issue.
If not can you resend this problem to relevant MySQL team?

I discovered this problem while developing and testing Perl DBI
connector DBD::MariaDB for accessing MariaDB and MySQL databases.

How to repeat:
Run the attached program.
[21 Nov 2018 13:55] Reggie Burnett
test file

Attachment: test-init.c (application/octet-stream, text), 993 bytes.

[21 Nov 2018 14:29] MySQL Verification Team
Hello Reggie,

Thank you for the report and feedback.

regards,
Umesh
[17 Dec 2018 19:27] Paul DuBois
Posted by developer:
 
Fixed in 8.0.15.

Opening and closing a connection multiple times in a client program
could cause the client to exit due to improper character set
reinitialization.
[6 Feb 2020 19:10] Paul DuBois
Posted by developer:
 
Fixed in 8.0.20.

Reinitialization of character sets from Index.xml could cause a
use-after-free error.