In GrContext::readSurfacePixels fail gracefully if temp pixmap allocation fails.
authorBrian Salomon <bsalomon@google.com>
Wed, 18 Jul 2018 18:34:44 +0000 (14:34 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 18 Jul 2018 18:38:02 +0000 (18:38 +0000)
Cherry Pick to M68

No-Tree-Checks: true
No-Try: true
No-Presubmit: true
Bug: chromium:860399
Change-Id: I6793e7fe7e97b7848d40170046dcff4c2fcc48c7
Reviewed-On: https://skia-review.googlesource.com/141101
Reviewed-By: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-on: https://skia-review.googlesource.com/142169

src/gpu/GrContext.cpp

index 24c28e6d862412dfa800e5654b7dc7cbffb93a19..a670495ad83ed45e161f096c19d1d6055533e2d3 100644 (file)
@@ -1177,7 +1177,9 @@ bool GrContextPriv::readSurfacePixels2(GrSurfaceContext* src, int left, int top,
         if (!SkImageInfoValidConversion(finalII, tempII)) {
             return false;
         }
-        tempPixmap.alloc(tempII);
+        if (!tempPixmap.tryAlloc(tempII)) {
+            return false;
+        }
         finalPixmap.reset(finalII, buffer, rowBytes);
         buffer = tempPixmap.writable_addr();
         rowBytes = tempPixmap.rowBytes();