Bug 1346601 - Set surfaceRect to empty when surface becomes null. r?Bas draft
authorMarkus Stange <mstange@themasta.com>
Thu, 12 Oct 2017 17:56:11 -0400
changeset 679553 e62c0596048e57fd82bc9d2dc97596ce532ec004
parent 679552 682a15c4a156493b599a7ab6dc592a8a3526f8ff
child 680988 9c37960dd6ef5e25c928c9ef64e0cba9795323ec
push id84272
push userbmo:mstange@themasta.com
push dateThu, 12 Oct 2017 21:59:45 +0000
reviewersBas
bugs1346601
milestone58.0a1
Bug 1346601 - Set surfaceRect to empty when surface becomes null. r?Bas MozReview-Commit-ID: 78oyzgSr8VT
gfx/2d/FilterNodeSoftware.cpp
gfx/tests/crashtests/1346601-1.html
gfx/tests/crashtests/crashtests.list
--- a/gfx/2d/FilterNodeSoftware.cpp
+++ b/gfx/2d/FilterNodeSoftware.cpp
@@ -746,17 +746,24 @@ FilterNodeSoftware::GetInputDataSourceSu
     printf(" -- no input --</section>\n\n");
 #endif
     return nullptr;
   }
 
   if (aTransparencyPaddedSourceRect && !aTransparencyPaddedSourceRect->IsEmpty()) {
     IntRect srcRect = aTransparencyPaddedSourceRect->Intersect(aRect);
     surface = GetDataSurfaceInRect(surface, surfaceRect, srcRect, EDGE_MODE_NONE);
-    surfaceRect = srcRect;
+    if (surface) {
+      surfaceRect = srcRect;
+    } else {
+      // Padding the surface with transparency failed, probably due to size
+      // restrictions. Since |surface| is now null, set the surfaceRect to
+      // empty so that we're consistent.
+      surfaceRect.SetEmpty();
+    }
   }
 
   RefPtr<DataSourceSurface> result =
     GetDataSurfaceInRect(surface, surfaceRect, aRect, aEdgeMode);
 
   if (result) {
     // TODO: This isn't safe since we don't have a guarantee
     // that future Maps will have the same stride
new file mode 100644
--- /dev/null
+++ b/gfx/tests/crashtests/1346601-1.html
@@ -0,0 +1,5 @@
+<svg>
+<filter id='a' width='181.412449629' primitiveUnits='objectBoundingBox'>
+<feConvolveMatrix kernelMatrix='0 1 1 1 0 0 0 0 0' kernelUnitLength='178'/>
+</filter>
+<polyline filter='url(#a)' points='47.2081,146 175.4644,1 260,191 4,0 85,176 88,248 16385,255.891 130,183 71,16'/>
--- a/gfx/tests/crashtests/crashtests.list
+++ b/gfx/tests/crashtests/crashtests.list
@@ -131,8 +131,9 @@ load 1134549-1.svg
 load balinese-letter-spacing.html
 load 1216832-1.html
 load 1225125-1.html
 load 1308394.html
 load 1317403-1.html # bug 1331533
 load 1325159-1.html
 load 1331683.html
 skip-if(Android) pref(dom.disable_open_during_load,false) load 1343666.html
+load 1346601-1.html