diff options
author | wang, biao <biao.wang@intel.com> | 2012-10-30 15:35:01 +0800 |
---|---|---|
committer | Wang LiangX <liangx.wang@intel.com> | 2014-04-09 18:56:48 +0800 |
commit | c847a4835b2233d28f6479deeed0592d267ee7bd (patch) | |
tree | 26813f1bbbc893b504c7d1af4cd58881ba88ba0f /media/jni | |
parent | b3cafa56205942343930e4fbb0a3d50d6e33a046 (diff) | |
download | frameworks_base-c847a4835b2233d28f6479deeed0592d267ee7bd.zip frameworks_base-c847a4835b2233d28f6479deeed0592d267ee7bd.tar.gz frameworks_base-c847a4835b2233d28f6479deeed0592d267ee7bd.tar.bz2 |
MetadataRetriever: Check null pointer to avoid tombstone crash.
When the app's vm-heap is not enough, memory allocation for big
object like bitmap may failed.
This patch add protection for bitmap creating to avoid segment
fault error in the following GetIntField function.
Change-Id: I63977dc602f4ed395afd11004a0ed027173fb685
Signed-off-by: wang, biao <biao.wang@intel.com>
Signed-off-by: TingX Li <tingx.li@intel.com>
Signed-off-by: Wang LiangX <liangx.wang@intel.com>
Diffstat (limited to 'media/jni')
-rw-r--r-- | media/jni/android_media_MediaMetadataRetriever.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp index 6176f0f..c2694f1 100644 --- a/media/jni/android_media_MediaMetadataRetriever.cpp +++ b/media/jni/android_media_MediaMetadataRetriever.cpp @@ -262,6 +262,13 @@ static jobject android_media_MediaMetadataRetriever_getFrameAtTime(JNIEnv *env, width, height, config); + if (jBitmap == NULL) { + if (env->ExceptionCheck()) { + env->ExceptionClear(); + } + ALOGE("getFrameAtTime: create Bitmap failed!"); + return NULL; + } SkBitmap *bitmap = (SkBitmap *) env->GetLongField(jBitmap, fields.nativeBitmap); |