Merge "Check that bitmap's size does not exceed 32 bits. DO NOT MERGE" into lmp-mr1-dev

This commit is contained in:
Leon Scroggins III
2015-02-10 22:03:43 +00:00
committed by Android (Google) Code Review

View File

@@ -536,7 +536,12 @@ jbyteArray GraphicsJNI::allocateJavaPixelRef(JNIEnv* env, SkBitmap* bitmap,
return NULL; 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, jbyteArray arrayObj = (jbyteArray) env->CallObjectMethod(gVMRuntime,
gVMRuntime_newNonMovableArray, gVMRuntime_newNonMovableArray,
gByte_class, size); gByte_class, size);