Bug #108508 Return value of field_store_string() not get checked
Submitted: 16 Sep 2022 0:11 Modified: 16 Sep 2022 5:23
Reporter: Li Zhong Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:8.0.21 OS:Any
Assigned to: CPU Architecture:Any

[16 Sep 2022 0:11] Li Zhong
Description:
Following call sites of field_store_string() could return error code but they're unchecked:
https://github.com/mysql/mysql-server/blob/f8cdce86448a211511e8a039c62580ae16cb96f5/storag...
https://github.com/mysql/mysql-server/blob/f8cdce86448a211511e8a039c62580ae16cb96f5/storag...
https://github.com/mysql/mysql-server/blob/f8cdce86448a211511e8a039c62580ae16cb96f5/storag...
https://github.com/mysql/mysql-server/blob/f8cdce86448a211511e8a039c62580ae16cb96f5/storag...
https://github.com/mysql/mysql-server/blob/f8cdce86448a211511e8a039c62580ae16cb96f5/storag...

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

Suggested fix:
Add check like:

OK(field_store_string(fields[IDX_DATABASE_NAME], db_utf8));
[16 Sep 2022 5:23] MySQL Verification Team
Hello Li Zhong,

Thank you for the report and feedback.

regards,
Umesh