diff options
author | Riley Andrews <riandrews@android.com> | 2015-11-01 23:36:04 -0800 |
---|---|---|
committer | The Android Automerger <android-build@google.com> | 2015-11-03 14:35:17 -0800 |
commit | a2dbe43122f5f8cb72d21ab4c9e7a9d570ba5d2e (patch) | |
tree | 2572a968a023e994a96e41f1a1d17753140fb6d6 /core/jni | |
parent | 423244469797cbaccd66f5ed210841647d7072e8 (diff) | |
download | frameworks_base-a2dbe43122f5f8cb72d21ab4c9e7a9d570ba5d2e.zip frameworks_base-a2dbe43122f5f8cb72d21ab4c9e7a9d570ba5d2e.tar.gz frameworks_base-a2dbe43122f5f8cb72d21ab4c9e7a9d570ba5d2e.tar.bz2 |
Limit persistent ashmem backed fds to a minimum of 128kB.
Bug 25256717
Change-Id: Ieb356006df0a6545b89de44d3d8fd4b46312b3b8
Signed-off-by: Riley Andrews <riandrews@google.com>
Diffstat (limited to 'core/jni')
-rwxr-xr-x | core/jni/android/graphics/Bitmap.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp index fbe3ece..6cbdeaa 100755 --- a/core/jni/android/graphics/Bitmap.cpp +++ b/core/jni/android/graphics/Bitmap.cpp @@ -28,6 +28,7 @@ #include <cutils/ashmem.h> #define DEBUG_PARCEL 0 +#define ASHMEM_BITMAP_MIN_SIZE (128 * (1 << 10)) namespace android { @@ -993,7 +994,7 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) { // Map the bitmap in place from the ashmem region if possible otherwise copy. Bitmap* nativeBitmap; - if (blob.fd() >= 0 && (blob.isMutable() || !isMutable)) { + if (blob.fd() >= 0 && (blob.isMutable() || !isMutable) && (size >= ASHMEM_BITMAP_MIN_SIZE)) { #if DEBUG_PARCEL ALOGD("Bitmap.createFromParcel: mapped contents of %s bitmap from %s blob " "(fds %s)", |