Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Handling Segfaults

Name: Anonymous 2016-09-09 22:18

What is the most portable way to catch segfaults together with their addresses and then resuming at the place where it happened? I.e. to handle array out of bounds exception by expanding array.

I know it is done with signal() on POSIX and with SetUnhandledExceptionFilter() on Windows. But you cant define signal() for Windows, because it has its own stripped down version, useful only for the purpose of handling CTRL-C.

Both don't signal() and SetUnhandledExceptionFilter() have no means of recovering from error.

Name: Anonymous 2016-09-12 12:23

>>22
Was just a suggestion, compatibility shims with #ifdef's will likely give >>1 what he needs, but he'll need to write new code for every OS he wants to support. What >>1 won't get will be actual safety, if his code actually goes out of bounds, that could be an exploitable vulnerability, such as a heap or stack overflow, and without bounds checking done by the language compiler or runtime or much more rarely, the hardware, if he gets as far as throwing an exception, things have already gone pretty wrong, and someone might be able to redirect code execution to anything they want.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List