Bug #108503 Check return error from os_file_create_subdirs_if_needed()
Submitted: 15 Sep 2022 23:49 Modified: 16 Sep 2022 4:57
Reporter: Li Zhong Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0.21 OS:Any
Assigned to: CPU Architecture:Any

[15 Sep 2022 23:49] Li Zhong
Hi, I'm researcher on static analysis and we find a potential unhandled error bug in MySQL-server-8.0.21 code:

In https://github.com/mysql/mysql-server/blob/mysql-cluster-8.0.21/storage/innobase/srv/srv0s...,   os_file_create_subdirs_if_needed(file_name) could fail but the error code is not checked, which may cause data corruption.

How to repeat:
We find this by our static analysis tool. The analysis result is checked manually.

Suggested fix:
Add the check after function call:

err =  os_file_create_subdirs_if_needed(file_name);

if (err != DB_SUCCESS) {
          << "Unable to create subdirectories '" << file_name << "'";
    return (err);
[16 Sep 2022 4:57] MySQL Verification Team
Hello Li Zhong,

Thank you for the report and feedback.