aboutsummaryrefslogtreecommitdiff
path: root/src/SBaseCommon.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <ladislav.zezula@avast.com>2021-12-17 14:51:35 +0100
committerLadislav Zezula <ladislav.zezula@avast.com>2021-12-17 14:51:35 +0100
commit1a94f94b50f6d829b1e8fba08a3002a5db4f00d5 (patch)
tree86e05dc27d67a68f5b5168df451d867db0902693 /src/SBaseCommon.cpp
parent5ab093b7a57b8779dff06a08fac19d46c40b3329 (diff)
Support for protected SCX files
Diffstat (limited to 'src/SBaseCommon.cpp')
-rw-r--r--src/SBaseCommon.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/SBaseCommon.cpp b/src/SBaseCommon.cpp
index a1aa78e..98d541a 100644
--- a/src/SBaseCommon.cpp
+++ b/src/SBaseCommon.cpp
@@ -1334,11 +1334,12 @@ DWORD AllocateSectorOffsets(TMPQFile * hf, bool bLoadFromFile)
// They are mostly empty on WoW release MPQs, but on MPQs from PTR,
// they contain random non-zero data. Their meaning is unknown.
//
- // These extra values are, however, include in the dwCmpSize in the file
+ // These extra values are, however, included in the dwCmpSize in the file
// table. We cannot ignore them, because compacting archive would fail
//
- if(hf->SectorOffsets[0] > dwSectorOffsLen)
+ // Clear the lower 2 bits in order to make sure that the value is aligned to 4 bytes
+ if((hf->SectorOffsets[0] & 0xFFFFFFFC) > dwSectorOffsLen)
{
// MPQ protectors put some ridiculous values there. We must limit the extra bytes
if(hf->SectorOffsets[0] > (dwSectorOffsLen + 0x400))