Bug #105586 Uninitialized value in storage/innobase/btr/btr0bulk.cc
Submitted: 16 Nov 2021 8:51 Modified: 16 Nov 2021 9:16
Reporter: Li Zhong Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[16 Nov 2021 8:51] Li Zhong
In the newest version of mysql-8.0 from github repo, in file sql/sql_help.cc function mysqld_help(), the variable 'count_topics' is possibly be used without initialized. 

If the execution path does not enter for block at https://github.com/mysql/mysql-server/blob/3290a66c89eb1625a7058e0ef732432b6952b435/sql/sq..., the variable 'count_topics' is not assigned with any value. But 'count_topics' will get checked in  https://github.com/mysql/mysql-server/blob/3290a66c89eb1625a7058e0ef732432b6952b435/sql/sq....

Since C compiler does not initialize 'count_topics' as 0 by default, the variable 'count_topics' may checked with a undefined value, which leads to code bugs.

How to repeat:
It's in source code of mysql-server-8.0.26

Suggested fix:
Initialize count_topics with 0
[16 Nov 2021 9:16] MySQL Verification Team
Hello Li Zhong,

Thank you for the report.