diff options
author | Leon Scroggins III <scroggo@google.com> | 2015-01-27 23:34:35 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-01-27 23:34:35 +0000 |
commit | 283ddb9d4f871e2816e37b9151108c01939b1f8a (patch) | |
tree | f3702182c41155bd9884de39401f120e2b8ce343 | |
parent | 0a3f0b020e4b1b025d8dc6c7cc9c34edc07ef902 (diff) | |
parent | 847514499f5920d073f5cd402dd0d3bbd19ac2c1 (diff) | |
download | frameworks_base-283ddb9d4f871e2816e37b9151108c01939b1f8a.zip frameworks_base-283ddb9d4f871e2816e37b9151108c01939b1f8a.tar.gz frameworks_base-283ddb9d4f871e2816e37b9151108c01939b1f8a.tar.bz2 |
am 3523e4fc: am efe085ff: Merge "Handle bad ninepatch data." into lmp-mr1-dev
automerge: 8475144
* commit '847514499f5920d073f5cd402dd0d3bbd19ac2c1':
Handle bad ninepatch data.
-rw-r--r-- | core/jni/android/graphics/NinePatchPeeker.cpp | 4 | ||||
-rw-r--r-- | include/androidfw/ResourceTypes.h | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/core/jni/android/graphics/NinePatchPeeker.cpp b/core/jni/android/graphics/NinePatchPeeker.cpp index 2644888..6c32a21 100644 --- a/core/jni/android/graphics/NinePatchPeeker.cpp +++ b/core/jni/android/graphics/NinePatchPeeker.cpp @@ -24,7 +24,9 @@ bool NinePatchPeeker::peek(const char tag[], const void* data, size_t length) { if (!strcmp("npTc", tag) && length >= sizeof(Res_png_9patch)) { Res_png_9patch* patch = (Res_png_9patch*) data; size_t patchSize = patch->serializedSize(); - assert(length == patchSize); + if (length != patchSize) { + return false; + } // You have to copy the data because it is owned by the png reader Res_png_9patch* patchNew = (Res_png_9patch*) malloc(patchSize); memcpy(patchNew, patch, patchSize); diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h index 421c5c1..8673219 100644 --- a/include/androidfw/ResourceTypes.h +++ b/include/androidfw/ResourceTypes.h @@ -118,9 +118,9 @@ struct Res_png_9patch yDivsOffset(0), colorsOffset(0) { } int8_t wasDeserialized; - int8_t numXDivs; - int8_t numYDivs; - int8_t numColors; + uint8_t numXDivs; + uint8_t numYDivs; + uint8_t numColors; // The offset (from the start of this structure) to the xDivs & yDivs // array for this 9patch. To get a pointer to this array, call |