Commit 4a7779df 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 1f9122a1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -114,6 +114,10 @@ bool MemoryBlockCache::EnsureBufferCanContain(size_t aContentLength) {
    // possibly bypass some future growths that would fit in this new 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;
  return true;
}