Bug 1229134: Check that memory allocation actually succeeded. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 01 Dec 2015 11:05:46 +1100
changeset 309261 76b10dad2e3d3090d73f7911b23dd68243a2d556
parent 309260 82e204405fe5a15aa88b18500131406f1d911f71
child 309262 f0979ce60a871f6e892acaf29c473108cc215a7d
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1229134
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1229134: Check that memory allocation actually succeeded. r=gerald
media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
--- a/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
@@ -1645,17 +1645,17 @@ status_t MPEG4Extractor::parseChunk(off6
         case FOURCC('a', 'v', 'c', 'C'):
         {
             if (chunk_data_size < 7) {
               ALOGE("short avcC chunk (%d bytes)", chunk_data_size);
               return ERROR_MALFORMED;
             }
 
             sp<ABuffer> buffer = new (fallible) ABuffer(chunk_data_size);
-            if (!buffer.get()) {
+            if (!buffer.get() || !buffer->data()) {
                 return -ENOMEM;
             }
 
             if (mDataSource->readAt(
                         data_offset, buffer->data(), chunk_data_size) < chunk_data_size) {
                 return ERROR_IO;
             }
 
@@ -1917,17 +1917,17 @@ status_t MPEG4Extractor::parseChunk(off6
             if (mFileMetaData != NULL) {
                 ALOGV("chunk_data_size = %lld and data_offset = %lld",
                         chunk_data_size, data_offset);
                 const int kSkipBytesOfDataBox = 16;
                 if (chunk_data_size <= kSkipBytesOfDataBox) {
                   return ERROR_MALFORMED;
                 }
                 sp<ABuffer> buffer = new (fallible) ABuffer(chunk_data_size + 1);
-                if (!buffer.get()) {
+                if (!buffer.get() || !buffer->data()) {
                     return -ENOMEM;
                 }
                 if (mDataSource->readAt(
                     data_offset, buffer->data(), chunk_data_size) != (ssize_t)chunk_data_size) {
                     return ERROR_IO;
                 }
                 mFileMetaData->setData(
                     kKeyAlbumArt, MetaData::TYPE_NONE,