Bug 1289397 - prevent overflow in CacheFileChunk::UpdateDataSize. r?valentin
MozReview-Commit-ID: HCZD9tkSr9I
--- a/netwerk/cache2/CacheFileChunk.cpp
+++ b/netwerk/cache2/CacheFileChunk.cpp
@@ -582,17 +582,17 @@ CacheFileChunk::UpdateDataSize(uint32_t
// and we never write data anymore once some error occurs.
MOZ_ASSERT(NS_SUCCEEDED(mStatus));
LOG(("CacheFileChunk::UpdateDataSize() [this=%p, offset=%d, len=%d]",
this, aOffset, aLen));
mIsDirty = true;
- int64_t fileSize = kChunkSize * mIndex + aOffset + aLen;
+ int64_t fileSize = static_cast<int64_t>(kChunkSize) * mIndex + aOffset + aLen;
bool notify = false;
if (fileSize > mFile->mDataSize) {
mFile->mDataSize = fileSize;
notify = true;
}
if (mState == READY || mState == WRITING) {