How a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2

Bug root cause and manifestation

  • The issue comes from a missing wheel-scale value for the Skimmer in a text data file; the parser reads one field fewer than expected.
  • The code then reads the wheel-scale from an uninitialized local variable, which previously happened to contain a “reasonable” leftover value from earlier stack usage.
  • In Windows 11 24H2 this leftover becomes a huge float, so the plane spawns extremely high above the map and appears to have vanished.

Why it only appeared on Windows 11 24H2

  • The underlying game bug has always been there; the OS change merely exposed it.
  • A new implementation of critical sections in Windows now uses more stack space, overwriting what used to be the “lucky” garbage value.
  • Commenters connect this to long-standing Windows app‑compat stories, where even internal stack layout changes can break buggy apps.

Undefined behavior and uninitialized memory

  • Many see this as a textbook example of how undefined behavior (UB) can lie dormant for years and surface after unrelated changes (OS, compiler, build mode).
  • Suggested mitigations: always initialize locals, compare debug vs release behavior, use sanitizers (ASan/UBSan/MSan), and run with stack-init patterns to flush out UB.
  • Some argue this class of bug is essentially impossible in languages that forbid uninitialized reads or enforce definite assignment.

Parsing, data formats, and libraries

  • Debate over 2004 constraints: low RAM, limited tooling, and weaker ecosystem for XML/JSON/YAML parsers, especially on consoles.
  • Others counter that even later titles from the same studio hand‑rolled fragile parsers (e.g., JSON via sscanf), causing severe performance or reliability problems.
  • Several insist teams should use well‑vetted open‑source parsers; others worry about library bloat, security issues, or 2000s-era licensing fears.

Languages, tooling, and safety

  • Thread branches into C/C++ vs managed or “safer” languages (Rust, functional languages, Java/C#), with many noting that most modern languages would have prevented this exact bug.
  • Skeptics point out game‑dev realities: existing C++ engines, console targets, performance constraints, and the cost/risk of adopting new languages at AAA scale.

Compatibility, contracts, and randomness

  • Some blame Microsoft for changing internal behavior; others insist the fault lies squarely with the game relying on UB.
  • Discussion of “if it’s not in the contract, randomize it” (e.g., map iteration order) as a way to prevent accidental reliance on unspecified behavior, balanced against performance and reproducibility concerns.