Merge "Handle bad ninepatch data." into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
efe085ffbd
@ -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);
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user