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

Commit 287c71ca authored by Doug Zongker's avatar Doug Zongker
Browse files

fix decompression bug in fastboot

fastboot passes the *uncompressed* length of the file as the length of
the input to the inflate() call, which happens to work unless the
compressed data is actually larger than the uncompressed data (which
it can be for very small files).  Fix this to pass the correct
compressed length down to the inflate call.
parent f8b8288c
Loading
Loading
Loading
Loading
+6 −9
Original line number Original line Diff line number Diff line
@@ -73,8 +73,6 @@ read_central_directory_entry(Zipfile* file, Zipentry* entry,
    unsigned short  lastModFileTime;
    unsigned short  lastModFileTime;
    unsigned short  lastModFileDate;
    unsigned short  lastModFileDate;
    unsigned long   crc32;
    unsigned long   crc32;
    unsigned long   compressedSize;
    unsigned long   uncompressedSize;
    unsigned short  extraFieldLength;
    unsigned short  extraFieldLength;
    unsigned short  fileCommentLength;
    unsigned short  fileCommentLength;
    unsigned short  diskNumberStart;
    unsigned short  diskNumberStart;
@@ -106,7 +104,7 @@ read_central_directory_entry(Zipfile* file, Zipentry* entry,
    lastModFileTime = read_le_short(&p[0x0c]);
    lastModFileTime = read_le_short(&p[0x0c]);
    lastModFileDate = read_le_short(&p[0x0e]);
    lastModFileDate = read_le_short(&p[0x0e]);
    crc32 = read_le_int(&p[0x10]);
    crc32 = read_le_int(&p[0x10]);
    compressedSize = read_le_int(&p[0x14]);
    entry->compressedSize = read_le_int(&p[0x14]);
    entry->uncompressedSize = read_le_int(&p[0x18]);
    entry->uncompressedSize = read_le_int(&p[0x18]);
    entry->fileNameLength = read_le_short(&p[0x1c]);
    entry->fileNameLength = read_le_short(&p[0x1c]);
    extraFieldLength = read_le_short(&p[0x1e]);
    extraFieldLength = read_le_short(&p[0x1e]);
@@ -253,4 +251,3 @@ read_central_dir(Zipfile *file)
bail:
bail:
    return -1;
    return -1;
}
}
+4 −4
Original line number Original line Diff line number Diff line
@@ -88,7 +88,7 @@ uninflate(unsigned char* out, int unlen, const unsigned char* in, int clen)
    zstream.zfree = Z_NULL;
    zstream.zfree = Z_NULL;
    zstream.opaque = Z_NULL;
    zstream.opaque = Z_NULL;
    zstream.next_in = (void*)in;
    zstream.next_in = (void*)in;
    zstream.avail_in = unlen;
    zstream.avail_in = clen;
    zstream.next_out = (Bytef*) out;
    zstream.next_out = (Bytef*) out;
    zstream.avail_out = unlen;
    zstream.avail_out = unlen;
    zstream.data_type = Z_UNKNOWN;
    zstream.data_type = Z_UNKNOWN;