Bug 1133645 - Check size of audio_specific_config before use. r=snorp
authorMatthew Gregan <kinetik@flim.org>
Wed, 18 Feb 2015 11:02:00 +1300
changeset 229640 602f3407d79a3bdc70fc15a3fb3efdeaf58fef75
parent 229560 14fad3f56818b61f160cf8a51079c49f5a2bbe25
child 229641 9b95a2885023286cbd1bfad543e7ac851739ed83
push id28294
push userryanvm@gmail.com
push dateThu, 19 Feb 2015 01:30:38 +0000
treeherdermozilla-central@360b5f211180 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1133645
milestone38.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 1133645 - Check size of audio_specific_config before use. r=snorp
dom/media/fmp4/android/AndroidDecoderModule.cpp
--- a/dom/media/fmp4/android/AndroidDecoderModule.cpp
+++ b/dom/media/fmp4/android/AndroidDecoderModule.cpp
@@ -200,17 +200,17 @@ public:
   AudioDataDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, MediaFormat::Param aFormat, MediaDataDecoderCallback* aCallback)
     : MediaCodecDataDecoder(MediaData::Type::AUDIO_DATA, aConfig.mime_type, aFormat, aCallback)
   {
     JNIEnv* env = GetJNIForThread();
 
     jni::Object::LocalRef buffer(env);
     NS_ENSURE_SUCCESS_VOID(aFormat->GetByteBuffer(NS_LITERAL_STRING("csd-0"), &buffer));
 
-    if (!buffer) {
+    if (!buffer && aConfig.audio_specific_config->Length() >= 2) {
       csd0[0] = (*aConfig.audio_specific_config)[0];
       csd0[1] = (*aConfig.audio_specific_config)[1];
 
       buffer = jni::Object::LocalRef::Adopt(env, env->NewDirectByteBuffer(csd0, 2));
       NS_ENSURE_SUCCESS_VOID(aFormat->SetByteBuffer(NS_LITERAL_STRING("csd-0"), buffer));
     }
   }