Bug 1600124 - Don't crash debug builds if we get an empty rectangle passed. r=rhunt
authorMatt Woodrow <mwoodrow@mozilla.com>
Mon, 16 Dec 2019 00:20:55 +0000
changeset 507038 0b2556575c730985732cc1a975cd0da577c4a17d
parent 507037 052b2bc4479fb0f91f3c3dc8658581a80ca251cc
child 507039 9d653dc355d3fec5c9870edd49f739d21be734e9
push id36921
push usernerli@mozilla.com
push dateMon, 16 Dec 2019 09:50:52 +0000
treeherdermozilla-central@0016ade97e65 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1600124
milestone73.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 1600124 - Don't crash debug builds if we get an empty rectangle passed. r=rhunt Depends on D57052 Differential Revision: https://phabricator.services.mozilla.com/D57053
gfx/ipc/CrossProcessPaint.cpp
--- a/gfx/ipc/CrossProcessPaint.cpp
+++ b/gfx/ipc/CrossProcessPaint.cpp
@@ -177,16 +177,20 @@ bool CrossProcessPaint::Start(dom::Windo
 
   Maybe<IntRect> rect;
   if (aRect) {
     rect =
         Some(IntRect::RoundOut((float)aRect->X(), (float)aRect->Y(),
                                (float)aRect->Width(), (float)aRect->Height()));
   }
 
+  if (rect && rect->IsEmpty()) {
+    return false;
+  }
+
   RefPtr<CrossProcessPaint> resolver =
       new CrossProcessPaint(aPromise, aScale, aRoot);
 
   if (aRoot->IsInProcess()) {
     RefPtr<dom::WindowGlobalChild> childActor = aRoot->GetChildActor();
     if (!childActor) {
       return false;
     }
@@ -230,17 +234,16 @@ void CrossProcessPaint::ReceiveFragment(
     CPP_LOG("Ignoring fragment from %p.\n", aWGP);
     return;
   }
 
   dom::TabId surfaceId = GetTabId(aWGP);
 
   MOZ_ASSERT(mPendingFragments > 0);
   MOZ_ASSERT(!mReceivedFragments.GetValue(surfaceId));
-  MOZ_ASSERT(!aFragment.IsEmpty());
 
   // Double check our invariants to protect against a compromised content
   // process
   if (mPendingFragments == 0 || mReceivedFragments.GetValue(surfaceId) ||
       aFragment.IsEmpty()) {
     CPP_LOG("Dropping invalid fragment from %p.\n", aWGP);
     LostFragment(aWGP);
     return;