Bug #108505 Check return pointer from dict_sdi_get_index()
Submitted: 15 Sep 2022 23:54 Modified: 16 Sep 2022 5:00
Reporter: Li Zhong Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:8.0.21 OS:Any
Assigned to: CPU Architecture:Any

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

In https://github.com/mysql/mysql-server/blob/mysql-cluster-8.0.21/storage/innobase/row/row0i..., dict_sdi_get_index(PFS_table_share*) could return nullptr. So when it is used in btr_root_adjust_on_import(), it's possible to cause null pointer dereference since btr_root_adjust_on_import() will dereference sdi_index without checking it is not null. 

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

Suggested fix:
Add check

ut_ad(index != nullptr);
[16 Sep 2022 5:00] MySQL Verification Team
Hello Li Zhong,

Thank you for the report and feedback.