diff options
author | strobe@google.com <strobe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-31 22:18:02 +0000 |
---|---|---|
committer | strobe@google.com <strobe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-31 22:18:02 +0000 |
commit | 8431fb193855b6820704a6fb72c3f1a2b8b62560 (patch) | |
tree | 218250bed707c791bc6d92f5d24d41b6ad62452b /media/mp4 | |
parent | ec78a5590a932c6c7a272b254a94c95d9e2a3aa0 (diff) | |
download | chromium_src-8431fb193855b6820704a6fb72c3f1a2b8b62560.zip chromium_src-8431fb193855b6820704a6fb72c3f1a2b8b62560.tar.gz chromium_src-8431fb193855b6820704a6fb72c3f1a2b8b62560.tar.bz2 |
Make peeking before the head of OffsetByteQueue a hard error.
BUG=
TEST=OffsetByteQueueTest
Review URL: https://chromiumcodereview.appspot.com/10823069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/mp4')
-rw-r--r-- | media/mp4/offset_byte_queue.cc | 1 | ||||
-rw-r--r-- | media/mp4/offset_byte_queue_unittest.cc | 4 |
2 files changed, 1 insertions, 4 deletions
diff --git a/media/mp4/offset_byte_queue.cc b/media/mp4/offset_byte_queue.cc index 862d937..a530150 100644 --- a/media/mp4/offset_byte_queue.cc +++ b/media/mp4/offset_byte_queue.cc @@ -37,6 +37,7 @@ void OffsetByteQueue::Pop(int count) { } void OffsetByteQueue::PeekAt(int64 offset, const uint8** buf, int* size) { + DCHECK(offset >= head()); if (offset < head() || offset >= tail()) { *buf = NULL; *size = 0; diff --git a/media/mp4/offset_byte_queue_unittest.cc b/media/mp4/offset_byte_queue_unittest.cc index 3a9b133..e2d40dc 100644 --- a/media/mp4/offset_byte_queue_unittest.cc +++ b/media/mp4/offset_byte_queue_unittest.cc @@ -48,10 +48,6 @@ TEST_F(OffsetByteQueueTest, TestPeekAt) { const uint8* buf; int size; - queue_->PeekAt(128, &buf, &size); - EXPECT_EQ(NULL, buf); - EXPECT_EQ(0, size); - queue_->PeekAt(400, &buf, &size); EXPECT_EQ(queue_->tail() - 400, size); EXPECT_EQ(400 - 256, buf[0]); |