summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLeon Scroggins III <scroggo@google.com>2015-01-27 22:48:29 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-27 22:48:29 +0000
commit1e0d4b5611f9a7134c9ab5fdb62b9385c5161c7c (patch)
tree4fea6f40e5a77980c361349909bf3aa17949a74e /core
parente8f6bd484627e16fa2fd9509b0f06056ee44be94 (diff)
parent1dbbc2045ae16a4923b30c9576703d02a4363529 (diff)
downloadframeworks_base-1e0d4b5611f9a7134c9ab5fdb62b9385c5161c7c.zip
frameworks_base-1e0d4b5611f9a7134c9ab5fdb62b9385c5161c7c.tar.gz
frameworks_base-1e0d4b5611f9a7134c9ab5fdb62b9385c5161c7c.tar.bz2
am 1dbbc204: am 6106f6a4: am 93522968: am 01287549: am 9a6143fa: Handle bad ninepatch data.
* commit '1dbbc2045ae16a4923b30c9576703d02a4363529': Handle bad ninepatch data.
Diffstat (limited to 'core')
-rw-r--r--core/jni/android/graphics/NinePatchPeeker.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/jni/android/graphics/NinePatchPeeker.cpp b/core/jni/android/graphics/NinePatchPeeker.cpp
index d3482da..077442e 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) == 0 && 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);