aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorreed <reed@google.com>2015-06-02 10:47:42 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-02 10:47:42 -0700
commit91284caa23274d2336884913bc7806745071bd72 (patch)
tree97a2ebe8c1375f3e8a5d12277cdbd3fdd9b2b076
parent1fa4572d1a32e9fbf102d7388efe5e44bef460f1 (diff)
downloadskia-91284caa23274d2336884913bc7806745071bd72.tar.gz
check (runtime) for null-pixels even when lock succeeds
BUG=492818 TBR= Review URL: https://codereview.chromium.org/1159953006
-rw-r--r--src/core/SkMipMap.cpp4
-rw-r--r--src/core/SkPixelRef.cpp6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index 77e0abc05..032a60d0f 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -239,6 +239,10 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
return NULL;
}
const SkPixmap& srcPixmap = srcUnlocker.pixmap();
+ // Try to catch where we might have returned NULL for src crbug.com/492818
+ if (NULL == srcPixmap.addr()) {
+ sk_throw();
+ }
SkMipMap* mipmap;
if (fact) {
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index c5aa3d130..4d6526882 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -199,7 +199,7 @@ bool SkPixelRef::lockPixelsInsideMutex() {
}
}
validate_pixels_ctable(fInfo, fRec.fPixels, fRec.fColorTable);
- return true;
+ return fRec.fPixels != NULL;
}
// For historical reasons, we always inc fLockCount, even if we return false.
@@ -224,7 +224,7 @@ bool SkPixelRef::lockPixels() {
}
}
validate_pixels_ctable(fInfo, fRec.fPixels, fRec.fColorTable);
- return true;
+ return fRec.fPixels != NULL;
}
bool SkPixelRef::lockPixels(LockRec* rec) {
@@ -274,7 +274,7 @@ bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) {
}
}
validate_pixels_ctable(fInfo, result->fPixels, result->fCTable);
- return true;
+ return result->fPixels != NULL;
}
bool SkPixelRef::lockPixelsAreWritable() const {