OpenTTD

Tasklist

FS#4645 - Possible of use of uninitialised variables in BmpReadHeader(...)

Attached to Project: OpenTTD
Opened by John Smits (Parody) - Wednesday, 15 June 2011, 17:43 GMT
Last edited by frosch (frosch) - Wednesday, 15 June 2011, 18:54 GMT
Type Patch
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

GCC 4.5 complains about the use of the struct BmpInfo info in BmpReadHeader(...). info->compression and info->palette_size are not being initialized, and I agree with that. This could lead to unpredictable behavior with corrupt or rigged BMP-files. The attached patch initializes these two to 0, which would at least lead to predictable behavior.
This task depends upon

Closed by  frosch (frosch)
Wednesday, 15 June 2011, 18:54 GMT
Reason for closing:  Fixed
Additional comments about closing:  in r22592 (just zeroing the whole struct)
Comment by John Smits (Parody) - Wednesday, 15 June 2011, 18:05 GMT
It must be late. ;) Missed one more compiler warning in bmp.cpp, same category. Attached patch contains all three now.

Loading...