Bug 1462912 - Fixed BufferList::Extract to handle the case where the call consumes the entirety of the BufferList. r=froydnj, a=RyanVM

This commit is contained in:
Alex Gaynor 2018-05-22 13:04:59 -04:00 committed by Roy Tam
commit 57b3983e17
2 changed files with 20 additions and 1 deletions

View file

@ -279,5 +279,17 @@ int main(void)
MOZ_RELEASE_ASSERT(bl9.Size() == 8);
MOZ_RELEASE_ASSERT(!iter.Done());
BufferList bl10(0, 0, 8);
bl10.WriteBytes("abcdefgh", 8);
bl10.WriteBytes("12345678", 8);
iter = bl10.Iter();
BufferList bl11 = bl10.Extract(iter, 16, &success);
MOZ_RELEASE_ASSERT(success);
MOZ_RELEASE_ASSERT(bl11.Size() == 16);
MOZ_RELEASE_ASSERT(iter.Done());
iter = bl11.Iter();
MOZ_RELEASE_ASSERT(bl11.ReadBytes(iter, data, 16));
MOZ_RELEASE_ASSERT(memcmp(data, "abcdefgh12345678", 16) == 0);
return 0;
}