mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1311361 - Crash in mozilla::net::CacheFileChunkBuffer::SetDataSize, r=honzab
This commit is contained in:
parent
125365b7da
commit
f3ecdc91f2
@ -118,8 +118,16 @@ void
|
||||
CacheFileChunkBuffer::SetDataSize(uint32_t aDataSize)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(
|
||||
mDataSize <= mBufSize ||
|
||||
(mBufSize == 0 && mChunk->mState == CacheFileChunk::READING));
|
||||
// EnsureBufSize must be called before SetDataSize, so the new data size
|
||||
// is guaranteed to be smaller than or equal to mBufSize.
|
||||
aDataSize <= mBufSize ||
|
||||
// The only exception is an optimization when we read the data from the
|
||||
// disk. The data is read to a separate buffer and CacheFileChunk::mBuf is
|
||||
// empty (see CacheFileChunk::Read). We need to set mBuf::mDataSize
|
||||
// accordingly so that DataSize() methods return correct value, but we don't
|
||||
// want to allocate the buffer since it wouldn't be used in most cases.
|
||||
(mDataSize == 0 && mBufSize == 0 && mChunk->mState == CacheFileChunk::READING));
|
||||
|
||||
mDataSize = aDataSize;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user