From 89a2466a2a2859df5f29350117efd7f9d6a2e32f Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Mon, 9 Feb 2015 15:42:19 -0500 Subject: Check that bitmap's size does not exceed 32 bits. DO NOT MERGE BUG:19270126 Change-Id: I075d1cefcd3208305a72b4fa629a262e92eb60ea --- core/jni/android/graphics/Graphics.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/jni') diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp index a51af40..3ea9b58 100644 --- a/core/jni/android/graphics/Graphics.cpp +++ b/core/jni/android/graphics/Graphics.cpp @@ -536,7 +536,12 @@ jbyteArray GraphicsJNI::allocateJavaPixelRef(JNIEnv* env, SkBitmap* bitmap, return NULL; } - const size_t size = bitmap->getSize(); + const int64_t size64 = bitmap->computeSize64(); + if (!sk_64_isS32(size64)) { + doThrowIAE(env, "bitmap size exceeds 32 bits"); + return NULL; + } + const size_t size = sk_64_asS32(size64); jbyteArray arrayObj = (jbyteArray) env->CallObjectMethod(gVMRuntime, gVMRuntime_newNonMovableArray, gByte_class, size); -- cgit v1.1