HeadlinesBriefing HeadlinesBriefing.com

Infidel Wild Pointer Bug Analysis

Hacker News •
×

Planetfall was yesterday's public release, but I've spent weeks on Infidel. I found an egregious bug: a wild pointer that scribbles over memory. Most call it trivial, but as a C programmer, I see memory corruption as the worst sin.

It's also a compiler bug. Infidel uses ENDLESS-DESERT to simulate unmapped areas. Dropped items go to DESERT-TABLE with lat/long.

The DESERT-TO-TABLE routine has a bug where it fails to properly handle the SLOC argument, causing memory corruption. The bug is hard to detect because items have a one-in-three chance of being lost to sand. I analyzed Infidel release 22 serial 840522 (Macintosh update); original release 830916 has the same bug.

The routine writes to DESERT-TABLE using incorrect indexing, overwriting adjacent memory. This violates memory safety despite minimal gameplay impact. The Z-machine implementation exposes the flaw via pointer arithmetic errors in the table update loop.

Source: Hacker News · Summarized by HeadlinesBriefing