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:
None 
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
Description:
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) {
    ib::error(ER_IB_MSG_776)
          << "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.

regards,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.042 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.