mirror of
https://github.com/ladislav-zezula/StormLib.git
synced 2026-02-14 17:58:34 +01:00
Fixed division by zero in https://github.com/ladislav-zezula/StormLib/issues/335
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user