am 6106f6a4: am 93522968: am 01287549: am 9a6143fa: Handle bad ninepatch data.

* commit '6106f6a490cb5816602e8e3ae84a5c653dda44d3':
  Handle bad ninepatch data.
This commit is contained in:
Leon Scroggins III
2015-01-27 22:42:03 +00:00
committed by Android Git Automerger
2 changed files with 6 additions and 4 deletions

View File

@ -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);

View File

@ -107,9 +107,9 @@ struct Res_png_9patch
yDivs(NULL), colors(NULL) { }
int8_t wasDeserialized;
int8_t numXDivs;
int8_t numYDivs;
int8_t numColors;
uint8_t numXDivs;
uint8_t numYDivs;
uint8_t numColors;
// These tell where the next section of a patch starts.
// For example, the first patch includes the pixels from