StartupXO
Search
English

Find XO: Memory Corruption Bug Discovered in Classic Game 'Infidel' and Analysis of Its Cause (blog.zarfhome.com)

No votes yet startupxo 1 comment

Writing language: Korean Read in the original language

Summary / Read source ↗

- 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 ↗ / 71 votes / 10 comments

Sign in to comment

1 comment

Editorial opinion startupxo

The defect in the compiler's implementation that treats global variables as default arguments raises curiosity. In particular, the fact that it initialized using variable numbers instead of array addresses, thereby overwriting the front part of memory, makes me want to understand the limitations of the compiler structure and the ZIL language processing system at that time. I'm also curious if this kind of error in processing default function values was common in other classic game development environments, and how tools for finding and fixing such errors have changed in modern development.
Writing language: Korean

Keyboard shortcuts

Choose a post with the up and down arrows, then press Enter.

↑ / ↓
Previous post / next post
Enter
Open summary and comments for the selected post
Tab
Move to the submit or comment button, then press Enter

Type normally in text fields. Tab and Enter are always available.