diff options
author | Alex Gaynor <agaynor@mozilla.com> | 2018-05-22 13:04:59 -0400 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-06-29 07:59:58 +0200 |
commit | ffbe05e06776f7e7e7233e74578312781888a249 (patch) | |
tree | 51445084435d753aa7c80ca538294ee689848117 /mfbt/BufferList.h | |
parent | 8ed2f59cc5f07299dfedc658283eb0ea4b49e08c (diff) | |
download | UXP-ffbe05e06776f7e7e7233e74578312781888a249.tar UXP-ffbe05e06776f7e7e7233e74578312781888a249.tar.gz UXP-ffbe05e06776f7e7e7233e74578312781888a249.tar.lz UXP-ffbe05e06776f7e7e7233e74578312781888a249.tar.xz UXP-ffbe05e06776f7e7e7233e74578312781888a249.zip |
Bug 1462912 - Fixed BufferList::Extract to handle the case where the call consumes the entirety of the BufferList. r=froydnj, a=RyanVM
Diffstat (limited to 'mfbt/BufferList.h')
-rw-r--r-- | mfbt/BufferList.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mfbt/BufferList.h b/mfbt/BufferList.h index aaff31454..7faf5a2ae 100644 --- a/mfbt/BufferList.h +++ b/mfbt/BufferList.h @@ -532,7 +532,14 @@ BufferList<AllocPolicy>::Extract(IterImpl& aIter, size_t aSize, bool* aSuccess) mSegments[aIter.mSegment].mCapacity)); aIter.Advance(*this, aIter.RemainingInSegment()); } - MOZ_RELEASE_ASSERT(aIter.mSegment == copyStart + segmentsToCopy); + // Due to the way IterImpl works, there are two cases here: (1) if we've + // consumed the entirety of the BufferList, then the iterator is pointed at + // the end of the final segment, (2) otherwise it is pointed at the start + // of the next segment. We want to verify that we really consumed all + // |segmentsToCopy| segments. + MOZ_RELEASE_ASSERT( + (aIter.mSegment == copyStart + segmentsToCopy) || + (aIter.Done() && aIter.mSegment == copyStart + segmentsToCopy - 1)); mSegments.erase(mSegments.begin() + copyStart, mSegments.begin() + copyStart + segmentsToCopy); |