alexbatalov / fallout2-ce

Fallout 2 for modern operating systems
Other
1.79k stars 123 forks source link

[[noreturn]] programFatalError does return #396

Open JanSimek opened 5 months ago

JanSimek commented 5 months ago

If we try to load a non-existing script through programCreateByPath then the gInterpreterCurrentProgram is NULL and the function programFatalError returns although it is marked as [[noreturn]], resulting in undefined behaviour. In my case, the subsequent return nullptr is skipped and the program crashes on fileGetSize.

Removing [[noreturn]] attribute fixes the crash. I am not sure if it can possibly break anything with that longjmp call in the programFatalError function.

phobos2077 commented 5 months ago

Well the longjmp is how it worked in the original. Any serious script error called this function to jump out of the script and stop execution.