mirror of
https://github.com/ladislav-zezula/StormLib.git
synced 2026-01-16 05:10:32 +01:00
validate dwHashTableSize
- dwHashTableSize must be a power of two, otherwise HASH_INDEX_MASK does not work
This commit is contained in:
@@ -2560,7 +2560,12 @@ DWORD LoadAnyHashTable(TMPQArchive * ha)
|
||||
// Note that we load the classic hash table even when HET table exists,
|
||||
// because if the MPQ gets modified and saved, hash table must be there
|
||||
if(pHeader->dwHashTableSize)
|
||||
{
|
||||
// hash-table size must be a power or 2
|
||||
if ((pHeader->dwHashTableSize & (pHeader->dwHashTableSize - 1)) != 0)
|
||||
return ERROR_FILE_CORRUPT;
|
||||
ha->pHashTable = LoadHashTable(ha);
|
||||
}
|
||||
|
||||
// At least one of the tables must be present
|
||||
if(ha->pHetTable == NULL && ha->pHashTable == NULL)
|
||||
|
||||
Reference in New Issue
Block a user