Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d7bd13f authored by Leon Scroggins III's avatar Leon Scroggins III Committed by android-build-merger
Browse files

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

automerge: 1e0d4b56

* commit '1e0d4b56':
  Handle bad ninepatch data.
parents eada048a 1e0d4b56
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -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)) {
    if (strcmp("npTc", tag) == 0 && length >= sizeof(Res_png_9patch)) {
        Res_png_9patch* patch = (Res_png_9patch*) data;
        Res_png_9patch* patch = (Res_png_9patch*) data;
        size_t patchSize = patch->serializedSize();
        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
        // You have to copy the data because it is owned by the png reader
        Res_png_9patch* patchNew = (Res_png_9patch*) malloc(patchSize);
        Res_png_9patch* patchNew = (Res_png_9patch*) malloc(patchSize);
        memcpy(patchNew, patch, patchSize);
        memcpy(patchNew, patch, patchSize);
+3 −3
Original line number Original line Diff line number Diff line
@@ -106,9 +106,9 @@ struct Res_png_9patch
                       yDivsOffset(0), colorsOffset(0) { }
                       yDivsOffset(0), colorsOffset(0) { }


    int8_t wasDeserialized;
    int8_t wasDeserialized;
    int8_t numXDivs;
    uint8_t numXDivs;
    int8_t numYDivs;
    uint8_t numYDivs;
    int8_t numColors;
    uint8_t numColors;


    // The offset (from the start of this structure) to the xDivs & yDivs
    // The offset (from the start of this structure) to the xDivs & yDivs
    // array for this 9patch. To get a pointer to this array, call
    // array for this 9patch. To get a pointer to this array, call