Bug 1186716 - Error if SPS NAL parsing failed. r=rillian, a=sylvestre
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 14 Sep 2015 15:34:33 -0700
changeset 289282 1eba35bfff209358a74bdf5f459de8df2e317054
parent 289281 7677798031de5de7999e0c0e7ffe4999f00620c8
child 289283 38ce3185609d4344607793379e20cbbe0cd979e2
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian, sylvestre
bugs1186716
milestone42.0a2
Bug 1186716 - Error if SPS NAL parsing failed. r=rillian, a=sylvestre
media/libstagefright/binding/H264.cpp
--- a/media/libstagefright/binding/H264.cpp
+++ b/media/libstagefright/binding/H264.cpp
@@ -485,22 +485,26 @@ H264::DecodeSPSFromExtraData(const mozil
     return false;
   }
 
   const uint8_t* ptr = reader.Read(length);
   if (!ptr) {
     return false;
   }
 
+  reader.DiscardRemaining();
+
   nsRefPtr<mozilla::MediaByteBuffer> rawNAL = new mozilla::MediaByteBuffer;
   rawNAL->AppendElements(ptr, length);
 
   nsRefPtr<mozilla::MediaByteBuffer> sps = DecodeNALUnit(rawNAL);
 
-  reader.DiscardRemaining();
+  if (!sps) {
+    return false;
+  }
 
   return DecodeSPS(sps, aDest);
 }
 
 /* static */ bool
 H264::EnsureSPSIsSane(SPSData& aSPS)
 {
   bool valid = true;