Bug 1334102: If the uploadRect is empty post-transform abort the function. The graphics driver may try to read from the given address even though it's told width or height are empty. r=milan
authorBas Schouten <bschouten@mozilla.com>
Tue, 31 Jan 2017 14:01:50 +0000
changeset 331834 069ef3c1416b4bb80b1aaaee819f3736cb682ca8
parent 331833 e807d24e9b10c0b78c63e8a597e329445c1d4bc2
child 331835 60b3df69c5a9e204c9da031e6b515c9b9b8cc391
push id31289
push userkwierso@gmail.com
push dateTue, 31 Jan 2017 23:13:55 +0000
treeherdermozilla-central@1d025ac534a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan
bugs1334102
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 1334102: If the uploadRect is empty post-transform abort the function. The graphics driver may try to read from the given address even though it's told width or height are empty. r=milan MozReview-Commit-ID: DxNOzU0SNHK
gfx/2d/HelpersD2D.h
--- a/gfx/2d/HelpersD2D.h
+++ b/gfx/2d/HelpersD2D.h
@@ -612,16 +612,21 @@ CreatePartialBitmapForSurface(DataSource
   } else if (rect.x >= 0 && rect.XMost() < size.width) {
     uploadRect.x = rect.x;
     uploadRect.width = rect.width;
   } else if (rect.y >= 0 && rect.YMost() < size.height) {
     uploadRect.y = rect.y;
     uploadRect.height = rect.height;
   }
 
+  if (uploadRect.IsEmpty()) {
+    // Nothing to be drawn.
+    return nullptr;
+  }
+
   if (uploadRect.width <= aRT->GetMaximumBitmapSize() &&
       uploadRect.height <= aRT->GetMaximumBitmapSize()) {
     {
       // Scope to auto-Unmap() |mapping|.
       DataSourceSurface::ScopedMap mapping(aSurface, DataSourceSurface::READ);
       if (MOZ2D_WARN_IF(!mapping.IsMapped())) {
         return nullptr;
       }