Memory Corruption Bug Discovered in Classic Game 'Infidel' and Analysis of Its Cause(blog.zarfhome.com)
Writing language: KoreanRead in the original language
Plain summary
- The text-based game Infidel uses an array to store the player's traveled locations and dropped item information to track their position within the desert.
- In the game's object saving function, when setting the array address as the default parameter, the code initializes it using a variable number (30) instead of directly referencing the global variable DESERT-TABLE (address 11129), causing data to be written to an incorrect memory area.
- This results in overwriting of other memory data like program abbreviations instead of the array's intended space, leading to corrupted output messages or, in some cases, game crashes.
- This issue existed identically in the Macintosh Infidel releases of 1983 and 1984, and was not detected by Infocom's debugging tools at the time. The fix involves explicitly assigning the global variable at the start of the function or specifying the array address during the call instead of relying on default parameters.
Found on
Hacker News ↗ / 131 votes / 20 comments
Have you run into something like this? Tell us in a line or two what you did. You do not need to know the product.