tmewett / BrogueCE

Brogue: Community Edition - a community-lead fork of the much-loved minimalist roguelike game
https://sites.google.com/site/broguegame/
GNU Affero General Public License v3.0
1.03k stars 109 forks source link

Adding out-of-range guard to plotChar+ functions #636

Closed flend closed 11 months ago

flend commented 11 months ago

Previously getInputTextString in debug builds would overwrite the edge of the displayBuffer due to the use of plotCharWithColor. This happened, for example, when printing the default save file name for debug builds (which have long version strings). This change adds guarding to the plotCharWithColor and plotCharToBuffer (which was already there but only as an assert for debug builds). I haven't changed plotChar since it's a lower level function where the caller will have to take responsibility for not writing outside of bounds.