diff options
author | Derek Sollenberger <djsollen@google.com> | 2015-05-19 14:38:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-19 14:38:52 +0000 |
commit | 252893df572256657d02b08eb52596bc9e82d5cc (patch) | |
tree | ecd3cb255caa1b77dd8da73214f166d9a8be1caa /core/jni | |
parent | 1f21d2a8b15d088ab50a62cbc389e88c09d141c1 (diff) | |
parent | cdadfc211ddd232fde9f63d9aa3ae26af8b8f583 (diff) | |
download | frameworks_base-252893df572256657d02b08eb52596bc9e82d5cc.zip frameworks_base-252893df572256657d02b08eb52596bc9e82d5cc.tar.gz frameworks_base-252893df572256657d02b08eb52596bc9e82d5cc.tar.bz2 |
Merge "Check that the parcel contained the expected amount of region data." into mnc-dev
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android/graphics/Region.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/jni/android/graphics/Region.cpp b/core/jni/android/graphics/Region.cpp index cf02e39..3bab2df 100644 --- a/core/jni/android/graphics/Region.cpp +++ b/core/jni/android/graphics/Region.cpp @@ -212,10 +212,14 @@ static jlong Region_createFromParcel(JNIEnv* env, jobject clazz, jobject parcel) android::Parcel* p = android::parcelForJavaObject(env, parcel); - SkRegion* region = new SkRegion; - size_t size = p->readInt32(); - size_t actualSize = region->readFromMemory(p->readInplace(size), size); + const size_t size = p->readInt32(); + const void* regionData = p->readInplace(size); + if (regionData == nullptr) { + return 0; + } + SkRegion* region = new SkRegion; + size_t actualSize = region->readFromMemory(regionData, size); if (size != actualSize) { delete region; return 0; |