aboutsummaryrefslogtreecommitdiff
path: root/src/SFileOpenArchive.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <ladislav.zezula@avg.com>2014-08-25 12:59:01 +0200
committerLadislav Zezula <ladislav.zezula@avg.com>2014-08-25 12:59:01 +0200
commitd7044aecaeb2bbb33e0f5cc2080d5b2995bd79d5 (patch)
treee260ef9d1415bef05b0071af573512d90f93ae3b /src/SFileOpenArchive.cpp
parent2b5b7e977145c16f6ec23933c41678c382d22de3 (diff)
+ Added support for newest Spazzler protector
Diffstat (limited to 'src/SFileOpenArchive.cpp')
-rw-r--r--src/SFileOpenArchive.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/SFileOpenArchive.cpp b/src/SFileOpenArchive.cpp
index 719aefe..98d8766 100644
--- a/src/SFileOpenArchive.cpp
+++ b/src/SFileOpenArchive.cpp
@@ -84,6 +84,9 @@ static int VerifyMpqTablePositions(TMPQArchive * ha, ULONGLONG FileSize)
if(pHeader->wHashTablePosHi || pHeader->dwHashTablePos)
{
ByteOffset = ha->MpqPos + MAKE_OFFSET64(pHeader->wHashTablePosHi, pHeader->dwHashTablePos);
+ if((pHeader->wFormatVersion == MPQ_FORMAT_VERSION_1) && (ha->dwFlags & MPQ_FLAG_MALFORMED))
+ ByteOffset = (DWORD)ha->MpqPos + pHeader->dwHashTablePos;
+
if(ByteOffset > FileSize)
return ERROR_BAD_FORMAT;
}
@@ -91,18 +94,12 @@ static int VerifyMpqTablePositions(TMPQArchive * ha, ULONGLONG FileSize)
// Check the begin of block table
if(pHeader->wBlockTablePosHi || pHeader->dwBlockTablePos)
{
+ ByteOffset = ha->MpqPos + MAKE_OFFSET64(pHeader->wBlockTablePosHi, pHeader->dwBlockTablePos);
if((pHeader->wFormatVersion == MPQ_FORMAT_VERSION_1) && (ha->dwFlags & MPQ_FLAG_MALFORMED))
- {
ByteOffset = (DWORD)ha->MpqPos + pHeader->dwBlockTablePos;
- if(ByteOffset > FileSize)
- return ERROR_BAD_FORMAT;
- }
- else
- {
- ByteOffset = ha->MpqPos + MAKE_OFFSET64(pHeader->wBlockTablePosHi, pHeader->dwBlockTablePos);
- if(ByteOffset > FileSize)
- return ERROR_BAD_FORMAT;
- }
+
+ if(ByteOffset > FileSize)
+ return ERROR_BAD_FORMAT;
}
// Check the begin of hi-block table