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:
ipavlin98 committed 2026-11-03 23:15:59 +03:00
1 parent 0f65b4ee07
commit 23d24bbc77
1 file changed
+5
+5
View File
@@ -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"