phy1um / ps2-homebrew-livestreams

Repo for code written during my Playstation 2 Homebrew livestreams
MIT License
47 stars 6 forks source link

Investigate Lua Syntax Error Crash #41

Open phy1um opened 2 years ago

phy1um commented 2 years ago

When Lua encounters a syntax error it triggers a segfault so extreme it even crashes PCSX2!

phy1um commented 2 years ago

The crash occurs when lua_error calls longjmp, and when longjmp executes jr ra, where the register ra has a value of 0x43. This appears to be outside the range of a valid address for the PS2, and causes the crash.

phy1um commented 2 years ago

This may be on the path to being resolved in 1674e9e with the merge of #62

I have experimented with some Lua compiler flags which seem to resolve this issue. More investigation needed, hopefully I can get this working without sacrificing GCC optimizations.