diff options
author | Ladislav Zezula <ladislav.zezula@avast.com> | 2021-12-17 14:51:35 +0100 |
---|---|---|
committer | Ladislav Zezula <ladislav.zezula@avast.com> | 2021-12-17 22:33:19 +0100 |
commit | 4f4f926c1a3347f7ecd18f549c4be0a1e62413ba (patch) | |
tree | f68df366a3afc64a60f48e679990e5c4504399a2 /src/SBaseCommon.cpp | |
parent | 5ced3835f9d52584bc20fb6a3a0e58069374e9af (diff) |
Support for protected SCX files
Diffstat (limited to 'src/SBaseCommon.cpp')
-rw-r--r-- | src/SBaseCommon.cpp | 5 |
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))
|