Commit 270e2ce9 authored by Chun-Min Chang's avatar Chun-Min Chang Committed by Matthew Finkel
Browse files

Bug 1650281 - P1: Widen `gCombinedSizes` once the buffers grow r=gerald

The `gCombinedSizes` need to be enlarged once the inner buffer within
`MemoryBlockCache` grows. Otherwise, when the `MemoryBlockCache` is
released, subtracting the buffer-size of the `MemoryBlockCache` from
`gCombinedSizes` lead to a underflow.

Differential Revision: https://phabricator.services.mozilla.com/D84273
parent cc5b0ae5
...@@ -114,6 +114,10 @@ bool MemoryBlockCache::EnsureBufferCanContain(size_t aContentLength) { ...@@ -114,6 +114,10 @@ bool MemoryBlockCache::EnsureBufferCanContain(size_t aContentLength) {
// possibly bypass some future growths that would fit in this new capacity. // possibly bypass some future growths that would fit in this new capacity.
mBuffer.SetLength(capacity); mBuffer.SetLength(capacity);
} }
const size_t newSizes = gCombinedSizes += (extra + extraCapacity);
LOG("EnsureBufferCanContain(%zu) - buffer size %zu + requested %zu + bonus "
"%zu = %zu; combined sizes %zu",
aContentLength, initialLength, extra, extraCapacity, capacity, newSizes);
mHasGrown = true; mHasGrown = true;
return true; return true;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment