You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Config file is correct (zero length string value) when a SDTG_MMANY/ManyOfMany setting has no bits set.
Actual result
Uninitialised bytes may be written into the config file when a SDTG_MMANY/ManyOfMany setting has no bits set.
Clearing all bits of display_opt may result in the config file line for display_opt having uninitialised bytes written for the value.
This may cause an error at config load time, and/or make the config file invalid UTF-8, etc.
ManyOfManySettingDesc::FormatValue does not write any bytes if there are no bits set, and the output buffer is not initialised, and therefore not zero-terminated after FormatValue is called.
(StringSettingDesc::FormatValue has extra code to handle this special case).
Version of OpenTTD
master
Expected result
Config file is correct (zero length string value) when a SDTG_MMANY/ManyOfMany setting has no bits set.
Actual result
Uninitialised bytes may be written into the config file when a SDTG_MMANY/ManyOfMany setting has no bits set.
Clearing all bits of
display_opt
may result in the config file line fordisplay_opt
having uninitialised bytes written for the value.This may cause an error at config load time, and/or make the config file invalid UTF-8, etc.
ManyOfManySettingDesc::FormatValue
does not write any bytes if there are no bits set, and the output buffer is not initialised, and therefore not zero-terminated after FormatValue is called.(
StringSettingDesc::FormatValue
has extra code to handle this special case).See also: JGRennison/OpenTTD-patches#344
Steps to reproduce
display_opt
in the usual way.The text was updated successfully, but these errors were encountered: