Skip to content

Commit 618c038

Browse files
committed
Resolve CID 1288510
1 parent ab97d8d commit 618c038

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cli/cppcheckexecutor.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,17 +596,20 @@ static void PrintCallstack(FILE* f, PEXCEPTION_POINTERS ex)
596596
static void writeMemoryErrorDetails(FILE* f, PEXCEPTION_POINTERS ex, const char* description)
597597
{
598598
fputs(description, f);
599+
// Using %p for ULONG_PTR later on, so it must have size identical to size of pointer
600+
// This is not the universally portable solution but good enough for Win32/64
601+
C_ASSERT(sizeof(void*) == sizeof(ex->ExceptionRecord->ExceptionInformation[1]));
599602
switch (ex->ExceptionRecord->ExceptionInformation[0]) {
600603
case 0:
601-
fprintf(f, " reading from 0x%x",
604+
fprintf(f, " reading from 0x%p",
602605
ex->ExceptionRecord->ExceptionInformation[1]);
603606
break;
604607
case 1:
605-
fprintf(f, " writing at 0x%x",
608+
fprintf(f, " writing at 0x%p",
606609
ex->ExceptionRecord->ExceptionInformation[1]);
607610
break;
608611
case 8:
609-
fprintf(f, " data execution prevention at 0x%x",
612+
fprintf(f, " data execution prevention at 0x%p",
610613
ex->ExceptionRecord->ExceptionInformation[1]);
611614
break;
612615
default:

0 commit comments

Comments
 (0)