Bug 1482452 - p1: validate buffer contents before accessing. r=snorp
authorJohn Lin <jolin@mozilla.com>
Wed, 16 Jan 2019 16:31:16 +0000
changeset 514117 0be55928fcb7ed372ee3f6aca33e5c7516593a2d
parent 514116 4fae3add610fe59fec7d7a59faaca897409ac078
child 514118 ba98166b6967ed4aeba972531b3488742c8339a0
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1482452
milestone66.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 1482452 - p1: validate buffer contents before accessing. r=snorp Differential Revision: https://phabricator.services.mozilla.com/D16707
dom/media/hls/HLSDemuxer.cpp
--- a/dom/media/hls/HLSDemuxer.cpp
+++ b/dom/media/hls/HLSDemuxer.cpp
@@ -351,20 +351,23 @@ void HLSTrackDemuxer::UpdateMediaInfo(in
       audioInfo->mRate = audioInfoObj->Rate();
       audioInfo->mChannels = audioInfoObj->Channels();
       audioInfo->mProfile = audioInfoObj->Profile();
       audioInfo->mBitDepth = audioInfoObj->BitDepth();
       audioInfo->mMimeType =
           NS_ConvertUTF16toUTF8(audioInfoObj->MimeType()->ToString());
       audioInfo->mDuration =
           TimeUnit::FromMicroseconds(audioInfoObj->Duration());
-      auto&& csd = audioInfoObj->CodecSpecificData()->GetElements();
-      audioInfo->mCodecSpecificConfig->Clear();
-      audioInfo->mCodecSpecificConfig->AppendElements(
-          reinterpret_cast<uint8_t*>(&csd[0]), csd.Length());
+      jni::ByteArray::LocalRef csdBytes = audioInfoObj->CodecSpecificData();
+      if (csdBytes) {
+        auto&& csd = csdBytes->GetElements();
+        audioInfo->mCodecSpecificConfig->Clear();
+        audioInfo->mCodecSpecificConfig->AppendElements(
+            reinterpret_cast<uint8_t*>(&csd[0]), csd.Length());
+      }
     }
   } else {
     infoObj = mParent->mHLSDemuxerWrapper->GetVideoInfo(index);
     auto* videoInfo = mTrackInfo->GetAsVideoInfo();
     if (infoObj && videoInfo) {
       java::GeckoVideoInfo::LocalRef videoInfoObj(std::move(infoObj));
       videoInfo->mStereoMode = getStereoMode(videoInfoObj->StereoMode());
       videoInfo->mRotation = getVideoInfoRotation(videoInfoObj->Rotation());