fix(libc): only call what() on std::exception types in DefaultTerminate #19
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by franpeza on 2026-09-26T20:28:07Z.
DefaultTerminateassumed every uncaught exception object has astd::exceptionvtable and called itswhat()slot. When the thrown type does not derive fromstd::exception(for examplethrow 42, a plain class, or a foreign exception), it read an arbitrary word as a vtable pointer and crashed before printing the terminate message.The thrown type is now matched against
std::exceptionwith the existingMatchhelper, andwhat()is called on the adjusted base pointer the match returns. The Windows guest-ABI path is unchanged.Testing: found and verified in my fork's macOS port, where an uncaught non-
std::exceptioncrashed inside the terminate handler; it now prints the type name and aborts. I have not built this branch on Linux or Windows.Note: #5 also edits these lines (it replaces
fprintfwithRawLog), so whichever lands second needs a trivial rebase.Pull request closed