summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorLeon Scroggins III <scroggo@google.com>2015-02-09 15:42:19 -0500
committerLeon Scroggins <scroggo@google.com>2015-02-10 20:57:45 +0000
commit89a2466a2a2859df5f29350117efd7f9d6a2e32f (patch)
tree6b85bb382a67da02359a05c09659d859a4c9da37 /core/jni
parent61333d1b51ae36c9e5b1f4ea95bd00731c5e991a (diff)
downloadframeworks_base-89a2466a2a2859df5f29350117efd7f9d6a2e32f.zip
frameworks_base-89a2466a2a2859df5f29350117efd7f9d6a2e32f.tar.gz
frameworks_base-89a2466a2a2859df5f29350117efd7f9d6a2e32f.tar.bz2
Check that bitmap's size does not exceed 32 bits. DO NOT MERGE
BUG:19270126 Change-Id: I075d1cefcd3208305a72b4fa629a262e92eb60ea
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android/graphics/Graphics.cpp7
1 files changed, 6 insertions, 1 deletions
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);