mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-20 04:35:57 +00:00
Report heap corruption from the vectored handler
The heap manager raises STATUS_HEAP_CORRUPTION and then ends the process itself, so the exception never reaches the unhandled-exception filter, and a run that corrupted its heap ended without a FATAL line. crash_veh hands it to crash_filter, which names the module and the host frames as for any other fault outside the executable.
This commit is contained in:
1 parent
0f65b4ee07
commit
23d24bbc77
1 file changed
+5
@@ -626,8 +626,13 @@ void plat_mem_fault_hook(int (*fn)(uint64_t addr)) {
|
||||
|
||||
static void (*crash_fn)(const PlatCrash *c);
|
||||
|
||||
static LONG WINAPI crash_filter(EXCEPTION_POINTERS *ep);
|
||||
|
||||
static LONG CALLBACK crash_veh(EXCEPTION_POINTERS *ep) {
|
||||
DWORD code = ep->ExceptionRecord->ExceptionCode;
|
||||
// Heap corruption is raised by the heap manager, which then ends the process itself: it never reaches the
|
||||
// unhandled-exception filter, so it is reported from here, wherever the heap was called from.
|
||||
if (code == 0xc0000374u) return crash_filter(ep); // STATUS_HEAP_CORRUPTION
|
||||
const char *what = code == EXCEPTION_ACCESS_VIOLATION ? "access violation"
|
||||
: code == EXCEPTION_ILLEGAL_INSTRUCTION ? "illegal instruction"
|
||||
: code == EXCEPTION_INT_DIVIDE_BY_ZERO ? "integer division by zero"
|
||||
|
||||
Reference in new issue
Block a user