Bug 1127554 - Do a fallible allocation in SampleIterator::GetNext. v1 r=mattwoodrow
☠☠ backed out by ec501c1722c0 ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Wed, 11 Feb 2015 15:25:26 -0800
changeset 249908 ec548321aaf2c59a711d6049e4c291d326b3e181
parent 249907 abcc80b81681af8b3689875a2955c25078160081
child 249909 d8fdb34c556518f6e87662014f7c76f97808f350
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1127554
milestone37.0a2
Bug 1127554 - Do a fallible allocation in SampleIterator::GetNext. v1 r=mattwoodrow
media/libstagefright/binding/Index.cpp
--- a/media/libstagefright/binding/Index.cpp
+++ b/media/libstagefright/binding/Index.cpp
@@ -94,17 +94,20 @@ MP4Sample* SampleIterator::GetNext()
   sample->decode_timestamp = s->mDecodeTime;
   sample->composition_timestamp = s->mCompositionRange.start;
   sample->duration = s->mCompositionRange.Length();
   sample->byte_offset = s->mByteRange.mStart;
   sample->is_sync_point = s->mSync;
   sample->size = s->mByteRange.Length();
 
   // Do the blocking read
-  sample->data = sample->extra_buffer = new uint8_t[sample->size];
+  sample->data = sample->extra_buffer = new (fallible) uint8_t[sample->size];
+  if (!sample->data) {
+    return nullptr;
+  }
 
   size_t bytesRead;
   if (!mIndex->mSource->ReadAt(sample->byte_offset, sample->data, sample->size,
                                &bytesRead) || bytesRead != sample->size) {
     return nullptr;
   }
 
   if (!s->mCencRange.IsNull()) {