From: Jay Freeman (saurik) Date: Wed, 6 Nov 2013 23:23:04 +0000 (-0800) Subject: Add support for protecting against bug #10227498. X-Git-Tag: v0.9.7^0 X-Git-Url: https://git.saurik.com/backport.git/commitdiff_plain/HEAD Add support for protecting against bug #10227498. --- diff --git a/src/com/saurik/backport/Hook.java b/src/com/saurik/backport/Hook.java index ae62a81..8dab649 100644 --- a/src/com/saurik/backport/Hook.java +++ b/src/com/saurik/backport/Hook.java @@ -108,6 +108,21 @@ public class Hook { } private static void fixZipFile$getInputStream() { + final Field ZipEntry$compressedSize = scanField(ZipEntry.class, "compressedSize"); + if (ZipEntry$compressedSize == null) + return; + ZipEntry$compressedSize.setAccessible(true); + + final Field ZipEntry$compressionMethod = scanField(ZipEntry.class, "compressionMethod"); + if (ZipEntry$compressionMethod == null) + return; + ZipEntry$compressionMethod.setAccessible(true); + + final Field ZipEntry$size = scanField(ZipEntry.class, "size"); + if (ZipEntry$size == null) + return; + ZipEntry$size.setAccessible(true); + final Field ZipEntry$nameLen = scanField(ZipEntry.class, "nameLen", "nameLength"); if (ZipEntry$nameLen == null) return; @@ -152,6 +167,10 @@ public class Hook { throw new ZipException("bug #9695860 [" + thiz.getName() + "]"); } + if (ZipEntry$compressionMethod.getInt(entry) == ZipEntry.STORED) + if (ZipEntry$compressedSize.getLong(entry) != ZipEntry$size.getLong(entry)) + throw new ZipException("bug #10227498 [" + thiz.getName() + "]"); + return invoke(thiz, args); } }