From 05858435ee8744de863be7e5ade05e4fd6edfb46 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Fri, 30 May 2014 01:06:44 +0000 Subject: [PATCH] Fixing a clusterfuzz found issue BUG=378175 R=reed@google.com, sugoi@google.com Author: sugoi@chromium.org Review URL: https://codereview.chromium.org/306033003 git-svn-id: http://skia.googlecode.com/svn/trunk@14983 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkBitmap.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index e5cc0d7fcd..522dfb1ebb 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -1308,7 +1308,9 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) { const int height = info.height(); const size_t snugSize = snugRB * height; const size_t ramSize = ramRB * height; - SkASSERT(snugSize <= ramSize); + if (!buffer->validate(snugSize <= ramSize)) { + return false; + } char* dst = (char*)sk_malloc_throw(ramSize); buffer->readByteArray(dst, snugSize);