From 1a94f94b50f6d829b1e8fba08a3002a5db4f00d5 Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Fri, 17 Dec 2021 14:51:35 +0100 Subject: Support for protected SCX files --- src/SBaseCommon.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/SBaseCommon.cpp') 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)) -- cgit v1.2.3