[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-78.6.1esr-10.0-1] Bug 1650281 - P1: Widen `gCombinedSizes` once the buffers grow r=gerald



commit 3fb01d16f69484f6d5b5568f909ff159b7159048
Author: Chun-Min Chang <chun.m.chang@xxxxxxxxx>
Date:   Tue Jul 21 23:38:57 2020 +0000

    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
---
 dom/media/MemoryBlockCache.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dom/media/MemoryBlockCache.cpp b/dom/media/MemoryBlockCache.cpp
index 2d31119dca0a..bf073e6769d0 100644
--- a/dom/media/MemoryBlockCache.cpp
+++ b/dom/media/MemoryBlockCache.cpp
@@ -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;
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits