From 0e892065bd1287f55568e62dd962a7cb57d30e52 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Fri, 19 Mar 2021 14:08:12 -0600 Subject: [PATCH] Correct exception handler sprintf for 32-bit (#3608) The size of ULONG_PTR varies based on the address size of the architecture. For 32-bit systems, it was invalid to treat it like a 64-bit value. By casting the value to a void pointer and changing the print code to %p, we get the right thing for all platforms --- tools/clang/tools/dxclib/dxc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/clang/tools/dxclib/dxc.cpp b/tools/clang/tools/dxclib/dxc.cpp index ae5c8f3a9..08b6b49a8 100644 --- a/tools/clang/tools/dxclib/dxc.cpp +++ b/tools/clang/tools/dxclib/dxc.cpp @@ -1241,7 +1241,7 @@ static LONG CALLBACK ExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo) else fputs("read", stderr); fputs(" from address ", stderr); - sprintf_s(scratch, _countof(scratch), "0x%016llx\n", pExceptionInfo->ExceptionRecord->ExceptionInformation[1]); + sprintf_s(scratch, _countof(scratch), "0x%p\n", (void*)pExceptionInfo->ExceptionRecord->ExceptionInformation[1]); fputs(scratch, stderr); } break; case EXCEPTION_STACK_OVERFLOW: