Bug 675630 - Fix null dereference in media memory reporter. r=cpearce
authorMatthew Gregan <kinetik@flim.org>
Tue, 02 Aug 2011 15:21:52 +1200
changeset 73655 b3a481c2e02aaa5b1ca5f07b0db9d6023086d613
parent 73654 f43cd1c730f899c4c79a57b4934f1b2c3d9760d1
child 73656 baa3a2a2cea43895296c1bc656056e6e2bda7b43
push idunknown
push userunknown
push dateunknown
reviewerscpearce
bugs675630
milestone8.0a1
Bug 675630 - Fix null dereference in media memory reporter. r=cpearce
content/media/nsBuiltinDecoderReader.h
--- a/content/media/nsBuiltinDecoderReader.h
+++ b/content/media/nsBuiltinDecoderReader.h
@@ -471,16 +471,19 @@ public:
                                PRInt64 aStartTime) = 0;
 
   class VideoQueueMemoryFunctor : public nsDequeFunctor {
   public:
     VideoQueueMemoryFunctor() : mResult(0) {}
 
     virtual void* operator()(void* anObject) {
       const VideoData* v = static_cast<const VideoData*>(anObject);
+      if (!v->mImage) {
+        return nsnull;
+      }
       NS_ASSERTION(v->mImage->GetFormat() == mozilla::layers::Image::PLANAR_YCBCR,
                    "Wrong format?");
       mozilla::layers::PlanarYCbCrImage* vi = static_cast<mozilla::layers::PlanarYCbCrImage*>(v->mImage.get());
 
       mResult += vi->GetDataSize();
       return nsnull;
     }