Verified Commit 1d6ec0a3 authored by Kash Shampur's avatar Kash Shampur Committed by Pier Angelo Vendrame
Browse files

Bug 1803109 - Discard blocks of data that are too big for two chunks. r=canaltinova

Currently, `ReserveAndPutRaw` allocates a second span even if the data would be too big for the chunk.
Here a second conditional is added to check if the block of data is too big in this scenario and silently discard the data if so.

Differential Revision: https://phabricator.services.mozilla.com/D167167
parent 1a7479a9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1088,6 +1088,12 @@ class ProfileChunkedBuffer {
          MOZ_ASSERT(maybeEntryWriter->RemainingBytes() == blockBytes);
          mRangeEnd += blockBytes;
          mPushedBlockCount += aBlockCount;
        } else if (blockBytes >= current->BufferBytes()) {
          // Currently only two buffer chunks are held at a time and it is not
          // possible to write an object that takes up more space than this. In
          // this scenario, silently discard this block of data if it is unable
          // to fit into the two reserved profiler chunks.
          mFailedPutBytes += blockBytes;
        } else {
          // Block doesn't fit fully in current chunk, it needs to overflow into
          // the next one.