Bug #105587 Possible Uninitialized Value in sql/sql_help.cc

Submitted: 16 Nov 2021 8:57 Modified: 16 Nov 2021 9:17
Reporter: Li Zhong Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:8.0.26 OS:Any
Assigned to: CPU Architecture:Any

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

If the execution path does not evaluate the second condition in while block at https://github.com/mysql/mysql-server/blob/3290a66c89eb1625a7058e0ef732432b6952b435/sql/tz..., the variable 'yleap' is not assigned with any value. But 'yleap' will get used in  https://github.com/mysql/mysql-server/blob/3290a66c89eb1625a7058e0ef732432b6952b435/sql/tz....

Since C compiler does not initialize 'yleap' as 0 by default, the variable 'yleap' may be assigned with a undefined value, which leads to code bugs like overflow.

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

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

Thank you for the report.

regards,
Umesh

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

Page generated in 0.040 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.