Bug 1206211: P2. Abort on OOM. r=kentuckyfriedtakahe
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 24 Sep 2015 13:08:28 +1000
changeset 264152 708cf76b6cb44a8565d013621d7ef9f71ab3ac78
parent 264151 680e1f669ea5cbd74fa27705b8a61de469d1748d
child 264153 ad2dda03780c60029ff7e2ddd6523a8970c1477b
push id65542
push userjyavenard@mozilla.com
push dateThu, 24 Sep 2015 06:46:43 +0000
treeherdermozilla-inbound@ad2dda03780c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe
bugs1206211
milestone44.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 1206211: P2. Abort on OOM. r=kentuckyfriedtakahe
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
@@ -511,16 +511,19 @@ status_t MPEG4Extractor::readMetaData() 
     for (size_t i = 0; i < mPssh.Length(); i++) {
         psshsize += 20 + mPssh[i].datalen;
     }
     if (psshsize > kMAX_ALLOCATION) {
         return ERROR_MALFORMED;
     }
     if (psshsize) {
         char *buf = (char*)malloc(psshsize);
+        if (!buf) {
+            return ERROR_MALFORMED;
+        }
         char *ptr = buf;
         for (size_t i = 0; i < mPssh.Length(); i++) {
             memcpy(ptr, mPssh[i].uuid, 20); // uuid + length
             memcpy(ptr + 20, mPssh[i].data, mPssh[i].datalen);
             ptr += (20 + mPssh[i].datalen);
         }
         mFileMetaData->setData(kKeyPssh, 'pssh', buf, psshsize);
         free(buf);