Bug #108513 Return value of get_instance() not get checked
Submitted: 16 Sep 2022 0:58 Modified: 16 Sep 2022 5:50
Reporter: Li Zhong Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:8.0.21 OS:Any
Assigned to: CPU Architecture:Any

[16 Sep 2022 0:58] Li Zhong
Description:
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/sql/set_var.cc#L808, Persisted_variables_cache::get_instance() could return nullptr. So when it is used in pv->set_variable(thd, setvar), it's possible to cause null pointer dereference. 

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

Suggested fix:
Add check on pv
[16 Sep 2022 5:50] MySQL Verification Team
Hello Li Zhong,

Thank you for the report and feedback.

regards,
Umesh