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-20 2:26

>>35
No Kernel32:
format PE GUI
section '.text' code readable executable
push 0
push _caption
push _message
push 0
call [MessageBoxW]
call [exit]
_caption dw 0x2764, 0x2764
_message dw 0x2764, 0x00
_exit db 0, 0, 0x65, 0x78, 0x69, 0x74, 0
_MessageBoxW db 0, 0, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x6F, 0x78, 0x57, 0
_libc db 'MSVCRT.DLL', 0
_user32 db 'USER32.DLL', 0

section '.idata' import data readable
dd 0, 0, 0, RVA _libc, RVA libc_table
dd 0, 0, 0, RVA _user32, RVA user32_table
dd 0, 0, 0, 0, 0

libc_table:
exit dd RVA _exit, 0
user32_table:
MessageBoxW dd RVA _MessageBoxW, 0

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