diff options
author | Ladislav Zezula <zezula-at-volny-dot-cz> | 2016-06-18 20:32:15 +0200 |
---|---|---|
committer | Ladislav Zezula <zezula-at-volny-dot-cz> | 2016-06-18 20:32:15 +0200 |
commit | 303631f9d7f753dacffb1e038dd273dc204e1ea9 (patch) | |
tree | 5397acd7c5b8efe6e1a721f0177b534e38d9acd6 /src/StormLib.h | |
parent | 47b6b6eb4addd82a89d6bcd8fa92f9c0a09a5781 (diff) |
+ Updated for protectors fiddling with too big block table index
Diffstat (limited to 'src/StormLib.h')
-rw-r--r-- | src/StormLib.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/StormLib.h b/src/StormLib.h index c25a1a8..3621096 100644 --- a/src/StormLib.h +++ b/src/StormLib.h @@ -230,7 +230,12 @@ extern "C" { MPQ_FILE_SIGNATURE | \ MPQ_FILE_EXISTS) -#define MPQ_BLOCK_INDEX(bi) ((bi) & 0x0FFFFFFF) // Index mask for block table index +// We need to mask out the upper 4 bits of the block table index. +// This is because it gets shifted out when calculating block table offset +// BlockTableOffset = pHash->dwBlockIndex << 0x04 +// Malformed MPQ maps may contain block indexes like 0x40000001 or 0xF0000023 +#define BLOCK_INDEX_MASK 0x0FFFFFFF +#define MPQ_BLOCK_INDEX(pHash) (pHash->dwBlockIndex & BLOCK_INDEX_MASK) // Compression types for multiple compressions #define MPQ_COMPRESSION_HUFFMANN 0x01 // Huffmann compression (used on WAVE files only) |