DescentDevelopers / Descent3

Descent 3 by Outrage Entertainment
GNU General Public License v3.0
2.74k stars 231 forks source link

[Runtime Issue]: Incomplete save files will crash the 'load game' menu #351

Closed Lgt2x closed 2 months ago

Lgt2x commented 2 months ago

Build Version

ad7c384

Operating System Environment

CPU Environment

Game Modes Affected

Game Environment

No response

Description

Corrupted/Empty save files will make selecting the "load game" menu crash the game. Related to #350

Regression Status

No response

Steps to Reproduce

Assuming ~/Descent is the game directory,


touch ~/Descent/savegame/saveg001
Descent3 -setdir ~/Descent```
Launch the game, and select "Load game" menu to crash
winterheart commented 2 months ago

Crash is generated by incorrect handling of CFileReadBytes() exception in LoadGameDialog() (or, to be precise, no handling at all). Commenting out this throwing https://github.com/DescentDevelopers/Descent3/blob/main/cfile/cfile.cpp#L924 fixes crash, but I still cannot get it work with try .. catch block.