Bug 1211262: Ensure that STORED entries in ZIP are considered corrupt if compressed and uncompressed sizes differ; r=mwu

This commit is contained in:
Aaron Klotz 2015-10-13 12:20:25 -06:00
parent 6fe5880641
commit a8d1e2c8cc

View File

@ -841,8 +841,10 @@ MOZ_WIN_MEM_TRY_BEGIN
// -- check if there is enough source data in the file // -- check if there is enough source data in the file
if (!offset || if (!offset ||
mFd->mLen < aItem->Size() || mFd->mLen < aItem->Size() ||
offset > mFd->mLen - aItem->Size()) offset > mFd->mLen - aItem->Size() ||
aItem->Compression() == STORED && aItem->Size() != aItem->RealSize()) {
return nullptr; return nullptr;
}
return mFd->mFileData + offset; return mFd->mFileData + offset;
MOZ_WIN_MEM_TRY_CATCH(return nullptr) MOZ_WIN_MEM_TRY_CATCH(return nullptr)