diff options
author | Ladislav Zezula <zezula@volny.cz> | 2024-04-21 22:35:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-21 22:35:07 +0200 |
commit | 3b65b373bc822a0ee0410edb80fa4ecfc0b454da (patch) | |
tree | 6d46b40a782aa282e60b3e9583d5a9120287c3b3 /src/SFileOpenArchive.cpp | |
parent | 605222393594f5885b877bfc0086dae756674965 (diff) | |
parent | 7250eca739f060dd6984b9ea74a9fbb8b0a7c353 (diff) |
Merge pull request #346 from ladislav-zezula/LZ_GabeShermanFoundBugs
Fixed bugs found by Gabe Sherman
Diffstat (limited to 'src/SFileOpenArchive.cpp')
-rw-r--r-- | src/SFileOpenArchive.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/SFileOpenArchive.cpp b/src/SFileOpenArchive.cpp index a97ecea..587aa96 100644 --- a/src/SFileOpenArchive.cpp +++ b/src/SFileOpenArchive.cpp @@ -501,10 +501,14 @@ bool WINAPI SFileOpenArchive( break; } - // Set the size of file sector - ha->dwSectorSize = (0x200 << ha->pHeader->wSectorSize); + // Set the size of file sector. Be sure to check for integer overflow + if((ha->dwSectorSize = (0x200 << ha->pHeader->wSectorSize)) == 0) + dwErrCode = ERROR_FILE_CORRUPT; + } - // Verify if any of the tables doesn't start beyond the end of the file + // Verify if any of the tables doesn't start beyond the end of the file + if(dwErrCode == ERROR_SUCCESS) + { dwErrCode = VerifyMpqTablePositions(ha, FileSize); } |