Bug 1335390 - prevent nul pointer dereference in parameter initialisation. r=baku
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Wed, 01 Feb 2017 15:20:45 +0200
changeset 331971 dd429b170253502460950d8123945ed763850581
parent 331970 6f8b490681e8699a992134f881a7d5ed245ac57e
child 331972 977ade17796bdf7d80edc12b5738819f41383157
push id31293
push userkwierso@gmail.com
push dateThu, 02 Feb 2017 00:07:12 +0000
treeherdermozilla-central@8196774c6b8a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1335390
milestone54.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 1335390 - prevent nul pointer dereference in parameter initialisation. r=baku MozReview-Commit-ID: H2RrwojBug
dom/media/MediaFormatReader.cpp
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -786,33 +786,38 @@ TrackTypeToStr(TrackInfo::TrackType aTra
 MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder,
                                      MediaDataDemuxer* aDemuxer,
                                      VideoFrameContainer* aVideoFrameContainer)
   : MediaDecoderReader(aDecoder)
   , mAudio(this, MediaData::AUDIO_DATA,
            Preferences::GetUint("media.audio-max-decode-error", 3))
   , mVideo(this, MediaData::VIDEO_DATA,
            Preferences::GetUint("media.video-max-decode-error", 2))
-  , mDemuxer(new DemuxerProxy(aDemuxer, aDecoder->AbstractMainThread()))
+  , mDemuxer(nullptr)
   , mDemuxerInitDone(false)
   , mLastReportedNumDecodedFrames(0)
   , mPreviousDecodedKeyframeTime_us(sNoPreviousDecodedKeyframe)
   , mInitDone(false)
   , mTrackDemuxersMayBlock(false)
   , mSeekScheduled(false)
   , mVideoFrameContainer(aVideoFrameContainer)
   , mDecoderFactory(new DecoderFactory(this))
 {
   MOZ_ASSERT(aDemuxer);
   MOZ_COUNT_CTOR(MediaFormatReader);
 
-  if (aDecoder && aDecoder->CompositorUpdatedEvent()) {
-    mCompositorUpdatedListener =
-      aDecoder->CompositorUpdatedEvent()->Connect(
-        mTaskQueue, this, &MediaFormatReader::NotifyCompositorUpdated);
+  if (aDecoder) {
+    mDemuxer = MakeUnique<DemuxerProxy>(aDemuxer,
+      aDecoder->AbstractMainThread());
+
+    if (aDecoder->CompositorUpdatedEvent()) {
+      mCompositorUpdatedListener =
+        aDecoder->CompositorUpdatedEvent()->Connect(
+          mTaskQueue, this, &MediaFormatReader::NotifyCompositorUpdated);
+    }
   }
 }
 
 MediaFormatReader::~MediaFormatReader()
 {
   MOZ_COUNT_DTOR(MediaFormatReader);
 }