From f7d7e9faf941aa1c9702d2712477001e4b8672d2 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 30 Apr 2009 02:41:20 +0000 Subject: [PATCH] - Fixed: FWadCollection::CheckNumForName() read the lump each iteration before checking for the end marker. On 32-bit systems, this is -1, but on 64-bit systems, it is a very large integer that is highly unlikely to be in mapped memory. SVN r1564 (trunk) --- docs/rh-log.txt | 8 +++++++- lzma/C/CpuArch.h | 2 ++ src/w_wad.cpp | 5 ++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 0f7495f59..cc083c88a 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,10 @@ -April 28, 2009 (Changes by Graf Zahl) +April 29, 2009 +- Fixed: FWadCollection::CheckNumForName() read the lump each iteration before + checking for the end marker. On 32-bit systems, this is -1, but on 64-bit + systems, it is a very large integer that is highly unlikely to be in mapped + memory. + +April 28, 2009 (Changes by Graf Zahl) - Added ML_BLOCKUSE line flag, accessible through UDMF and Line_SetBlocking. April 25, 2009 (Changes by Graf Zahl) diff --git a/lzma/C/CpuArch.h b/lzma/C/CpuArch.h index 006361f2f..db441641b 100644 --- a/lzma/C/CpuArch.h +++ b/lzma/C/CpuArch.h @@ -47,6 +47,8 @@ about these properties of platform. #if defined(LITTLE_ENDIAN_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300) +unsigned long _byteswap_ulong(unsigned long); +unsigned __int64 _byteswap_uint64(unsigned __int64); #pragma intrinsic(_byteswap_ulong) #pragma intrinsic(_byteswap_uint64) #define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p)) diff --git a/src/w_wad.cpp b/src/w_wad.cpp index a303310f7..73d45e9b7 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -418,6 +418,7 @@ int FWadCollection::CheckNumForName (const char *name, int space) int FWadCollection::CheckNumForName (const char *name, int space, int wadnum, bool exact) { + FResourceLump *lump; char uname[8]; DWORD i; @@ -428,18 +429,16 @@ int FWadCollection::CheckNumForName (const char *name, int space, int wadnum, bo uppercopy (uname, name); i = FirstLumpIndex[LumpNameHash (uname) % NumLumps]; - FResourceLump *lump = LumpInfo[i].lump; // If exact is true if will only find lumps in the same WAD, otherwise // also those in earlier WADs. while (i != NULL_INDEX && - (*(QWORD *)&lump->Name != *(QWORD *)&uname || + (lump = LumpInfo[i].lump, *(QWORD *)&lump->Name != *(QWORD *)&uname || lump->Namespace != space || (exact? (LumpInfo[i].wadnum != wadnum) : (LumpInfo[i].wadnum > wadnum)) )) { i = NextLumpIndex[i]; - lump = LumpInfo[i].lump; } return i != NULL_INDEX ? i : -1;