dethrace-labs / dethrace

Reverse engineering the 1997 game "Carmageddon"
https://twitter.com/dethrace_labs
GNU General Public License v3.0
859 stars 44 forks source link

Sound sample NULL pointer dereferences #284

Closed zear closed 1 year ago

zear commented 1 year ago

It is possible to trigger a NULL pointer dereference by muting sound while in main menu, which prevents sound samples from loading with the rest of game data. When the sound is then unmuted during gameplay, an attempt to play affected sound effects will crash the game. This is most prominent for pratcam sounds.

This issue also occurs in OG and can be triggered in the Windows builds. It most likely has been carried over from the DOS codebase, but hasn't been discovered during original playtesting, since DOS doesn't have the same concept of memory protection as multi-tasking OSes.

Steps to reproduce:

  1. Launch the game.
  2. While in main menu, press s in order to mute sound.
  3. Load a track all the way through into gameplay.
  4. While in-game, press s again to unmute sounds.
  5. Trigger a pratcam sound effect (e.g. by running over peds).
zear commented 1 year ago

Fixed in https://github.com/dethrace-labs/dethrace/pull/285.