Bug 1331274 - aPath coming into Fill method may not be valid. r=kechen, a=gchang
authorMilan Sreckovic <milan@mozilla.com>
Mon, 16 Jan 2017 13:21:36 -0500
changeset 465433 dd4b8065a9a9ba168c84674bcd4071b0b4a8b7b0
parent 465432 84a38c1c11a687e63bb6a5ee0f4ffc7d232374f9
child 465434 8e692dd4176cba81ce020b29ae8b352dc1db724a
child 465642 aa8b10dca83df22981e98ce094adc7bcfb54101a
push id42592
push userhikezoe@mozilla.com
push dateTue, 24 Jan 2017 02:07:18 +0000
reviewerskechen, gchang
bugs1331274
milestone51.0
Bug 1331274 - aPath coming into Fill method may not be valid. r=kechen, a=gchang CLOSED TREE MozReview-Commit-ID: 5tmGUXEFJlw
gfx/2d/DrawTargetD2D1.cpp
gfx/2d/DrawTargetSkia.cpp
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -495,17 +495,17 @@ DrawTargetD2D1::Stroke(const Path *aPath
   FinalizeDrawing(aOptions.mCompositionOp, aPattern);
 }
 
 void
 DrawTargetD2D1::Fill(const Path *aPath,
                      const Pattern &aPattern,
                      const DrawOptions &aOptions)
 {
-  if (aPath->GetBackendType() != BackendType::DIRECT2D1_1) {
+  if (!aPath || aPath->GetBackendType() != BackendType::DIRECT2D1_1) {
     gfxDebug() << *this << ": Ignoring drawing call for incompatible path.";
     return;
   }
   const PathD2D *d2dPath = static_cast<const PathD2D*>(aPath);
 
   PrepareForDrawing(aOptions.mCompositionOp, aPattern);
 
   mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode));
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -729,17 +729,17 @@ DrawTargetSkia::StrokeLine(const Point &
 }
 
 void
 DrawTargetSkia::Fill(const Path *aPath,
                     const Pattern &aPattern,
                     const DrawOptions &aOptions)
 {
   MarkChanged();
-  if (aPath->GetBackendType() != BackendType::SKIA) {
+  if (!aPath || aPath->GetBackendType() != BackendType::SKIA) {
     return;
   }
 
   const PathSkia *skiaPath = static_cast<const PathSkia*>(aPath);
 
   AutoPaintSetup paint(mCanvas.get(), aOptions, aPattern);
 
   if (!skiaPath->GetPath().isFinite()) {