Skip to content

Commit 4070a32

Browse files
committed
fix: parsing of apkprotector ZIPs
1 parent 90591e0 commit 4070a32

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

zipreader.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,15 @@ func OpenZipReader(zipReader io.ReadSeeker) (zr *ZipReader, err error) {
234234
zipinfo, err = tryReadZip(f)
235235
if err == nil {
236236
for i, zf := range zipinfo.File {
237-
// Android treats anything but 0 as deflate.
238237
if zf.Method != zip.Store && zf.Method != zip.Deflate {
239-
zipinfo.File[i].Method = zip.Deflate
238+
// Android code seems to be treating unknown method as deflate, but
239+
// 9a7d5266c223122d24d0061465bf781888984b4b04d9d0df8a76c3e3fe7a3fd0 has method 3217
240+
// and the file is really stored, not sure how it works on device.
241+
if zf.UncompressedSize64 == zf.CompressedSize64 {
242+
zipinfo.File[i].Method = zip.Store
243+
} else {
244+
zipinfo.File[i].Method = zip.Deflate
245+
}
240246
}
241247

242248
cl := path.Clean(zf.Name)

0 commit comments

Comments
 (0)