From 4c5b1a6ff404e60706d3da22374584585c291404 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Thu, 22 Jun 2006 16:47:10 +0200 Subject: [PATCH] Added some assertions to track down a win32/pe unpack problem which shows up on 64-bit machines. --- src/p_w32pe.cpp | 1 + src/util.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index cc8b6e0b..e858fc0d 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -2388,6 +2388,7 @@ void PackW32Pe::rebuildImports(upx_byte *& extrainfo) const unsigned ilen = strlen(++p) + 1; if (inamespos) { + assert(oimpdlls != NULL); // FIXME if (ptr_diff(importednames,oimpdlls) & 1) importednames -= 1; omemcpy(importednames + 2, p, ilen); diff --git a/src/util.h b/src/util.h index 2706b6e9..e65171b7 100644 --- a/src/util.h +++ b/src/util.h @@ -69,6 +69,7 @@ template inline int ptr_diff(const T *p1, const T *p2) { COMPILE_TIME_ASSERT(sizeof(T) == 1) + assert(p1 != NULL); assert(p2 != NULL); ptrdiff_t d = (const char*) p1 - (const char*) p2; assert((int)d == d); return (int) d; @@ -76,6 +77,7 @@ inline int ptr_diff(const T *p1, const T *p2) #endif inline int ptr_diff(const void *p1, const void *p2) { + assert(p1 != NULL); assert(p2 != NULL); ptrdiff_t d = (const char*) p1 - (const char*) p2; assert((int)d == d); return (int) d;