summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins III <scroggo@google.com>2015-05-27 14:29:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-27 14:29:31 +0000
commitb36ace7401c0e198ceddd2fdb908346b7bb5928f (patch)
treecc0df38cebd69ebde738334cf0f6097f2d2374da
parentc9a0c0b90773fded6c251646300231f67c891b78 (diff)
parent5cfd16201fbcb4a095071058263682f7b4ab77a5 (diff)
downloadframeworks_base-b36ace7401c0e198ceddd2fdb908346b7bb5928f.zip
frameworks_base-b36ace7401c0e198ceddd2fdb908346b7bb5928f.tar.gz
frameworks_base-b36ace7401c0e198ceddd2fdb908346b7bb5928f.tar.bz2
Merge "Check that the parcel contained the expected amount of region data. DO NOT MERGE" into lmp-dev
-rw-r--r--core/jni/android/graphics/Region.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/jni/android/graphics/Region.cpp b/core/jni/android/graphics/Region.cpp
index 912968a..6b99de8 100644
--- a/core/jni/android/graphics/Region.cpp
+++ b/core/jni/android/graphics/Region.cpp
@@ -212,9 +212,13 @@ static jlong Region_createFromParcel(JNIEnv* env, jobject clazz, jobject parcel)
android::Parcel* p = android::parcelForJavaObject(env, parcel);
+ const size_t size = p->readInt32();
+ const void* regionData = p->readInplace(size);
+ if (regionData == NULL) {
+ return NULL;
+ }
SkRegion* region = new SkRegion;
- size_t size = p->readInt32();
- region->readFromMemory(p->readInplace(size), size);
+ region->readFromMemory(regionData, size);
return reinterpret_cast<jlong>(region);
}