summaryrefslogtreecommitdiffstats
path: root/core/jni/android
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-08-29 16:55:55 -0700
committerMathieu Chartier <mathieuc@google.com>2014-08-29 16:57:30 -0700
commita08d10fa7051668b629d561bb8411e34d28fdabf (patch)
treeff381804ae06540bb05cb93075a60a0cc1555ddb /core/jni/android
parentb48be6e8588e763c938bdc1b0dc778f6de82242e (diff)
downloadframeworks_base-a08d10fa7051668b629d561bb8411e34d28fdabf.zip
frameworks_base-a08d10fa7051668b629d561bb8411e34d28fdabf.tar.gz
frameworks_base-a08d10fa7051668b629d561bb8411e34d28fdabf.tar.bz2
Add missing null check to ninePatchInsets
ninePatchInsets could be null after allocation, this possibly caused a SIGABRT in GC or check_jni failure. Bug: 17323232 Change-Id: Icd7e3819032e8e999d3c1483bf261bb39b3fe9e4
Diffstat (limited to 'core/jni/android')
-rw-r--r--core/jni/android/graphics/BitmapFactory.cpp3
-rw-r--r--core/jni/android/graphics/Graphics.cpp1
2 files changed, 4 insertions, 0 deletions
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 62ea351..8ea28ec 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -367,6 +367,9 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding
peeker.mOpticalInsets[0], peeker.mOpticalInsets[1], peeker.mOpticalInsets[2], peeker.mOpticalInsets[3],
peeker.mOutlineInsets[0], peeker.mOutlineInsets[1], peeker.mOutlineInsets[2], peeker.mOutlineInsets[3],
peeker.mOutlineRadius, peeker.mOutlineAlpha, scale);
+ if (ninePatchInsets == NULL) {
+ return nullObjectReturn("nine patch insets == null");
+ }
if (javaBitmap != NULL) {
env->SetObjectField(javaBitmap, gBitmap_ninePatchInsetsFieldID, ninePatchInsets);
}
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index 7c41c2e..d7b75db 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -419,6 +419,7 @@ jobject GraphicsJNI::createBitmap(JNIEnv* env, SkBitmap* bitmap, jbyteArray buff
{
SkASSERT(bitmap);
SkASSERT(bitmap->pixelRef());
+ SkASSERT(!env->ExceptionCheck());
bool isMutable = bitmapCreateFlags & kBitmapCreateFlag_Mutable;
bool isPremultiplied = bitmapCreateFlags & kBitmapCreateFlag_Premultiplied;