frameworks/base
修订版 | 1e72dc7a3074cd0b44d89afbf39bbf5000ef7cc3 (tree) |
---|---|
时间 | 2015-08-14 11:41:42 |
作者 | Leon Scroggins III <scroggo@goog...> |
Commiter | The Android Automerger |
DO NOT MERGE: Ensure that unparcelling Region only reads the expected number of bytes
bug: 20883006
Change-Id: I4f109667fb210a80fbddddf5f1bfb7ef3a02b6ce
@@ -218,7 +218,12 @@ static jlong Region_createFromParcel(JNIEnv* env, jobject clazz, jobject parcel) | ||
218 | 218 | return NULL; |
219 | 219 | } |
220 | 220 | SkRegion* region = new SkRegion; |
221 | - region->readFromMemory(regionData, size); | |
221 | + size_t actualSize = region->readFromMemory(regionData, size); | |
222 | + | |
223 | + if (size != actualSize) { | |
224 | + delete region; | |
225 | + return NULL; | |
226 | + } | |
222 | 227 | |
223 | 228 | return reinterpret_cast<jlong>(region); |
224 | 229 | } |