aboutsummaryrefslogtreecommitdiff
path: root/src/SFileAddFile.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <ladislav.zezula@avg.com>2014-12-23 15:04:35 +0100
committerLadislav Zezula <ladislav.zezula@avg.com>2014-12-23 15:04:35 +0100
commite9842c38cf9c55f682b2a411cea84ee59d69ec92 (patch)
treee84f32cb42246743b1ce84e91910d855b0ee13a6 /src/SFileAddFile.cpp
parent48b5cb606e5f1b407069a1babfb17ccbcb630e55 (diff)
+ Adding files into MPQs that have BlockTableSize > HashTableSize is not allowed
+ Compacting MPQs that have BlockTableSize > HashTableSize is allowed
Diffstat (limited to 'src/SFileAddFile.cpp')
-rw-r--r--src/SFileAddFile.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/SFileAddFile.cpp b/src/SFileAddFile.cpp
index 5997c1b..524fb50 100644
--- a/src/SFileAddFile.cpp
+++ b/src/SFileAddFile.cpp
@@ -725,6 +725,14 @@ bool WINAPI SFileCreateFile(
nError = ERROR_INVALID_PARAMETER;
}
+ // Check for MPQs that have invalid block table size
+ // Example: size of block table: 0x41, size of hash table: 0x40
+ if(nError == ERROR_SUCCESS)
+ {
+ if(ha->dwFileTableSize > ha->dwMaxFileCount)
+ nError = ERROR_DISK_FULL;
+ }
+
// Initiate the add file operation
if(nError == ERROR_SUCCESS)
nError = SFileAddFile_Init(ha, szArchivedName, FileTime, dwFileSize, lcLocale, dwFlags, (TMPQFile **)phFile);