From d6bb92034ec9f52d541c295d349ad4e32ce6fbe5 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 31 Jul 2013 18:24:40 -0700 Subject: [PATCH] Add support for what I had previously called bug B. --- src/com/saurik/backport/Hook.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/com/saurik/backport/Hook.java b/src/com/saurik/backport/Hook.java index 1744455..d1eb950 100644 --- a/src/com/saurik/backport/Hook.java +++ b/src/com/saurik/backport/Hook.java @@ -105,6 +105,11 @@ public class Hook { } private static void fixZipFile$getInputStream() { + final Field ZipEntry$nameLen = scanField(ZipEntry.class, "nameLen", "nameLength"); + if (ZipEntry$nameLen == null) + return; + ZipEntry$nameLen.setAccessible(true); + final Field ZipFile$mRaf = scanField(ZipFile.class, "mRaf", "raf"); if (ZipFile$mRaf == null) return; @@ -134,7 +139,12 @@ public class Hook { if ((raf.readShort() & 0x0080) != 0) throw new ZipException("bug #9695860 [" + thiz.getName() + "]"); - raf.skipBytes(20); + raf.skipBytes(18); + + int length = raf.readShort() & 0xffff; + if (length != ZipEntry$nameLen.getInt(entry)) + throw new ZipException("bug #sauriks [" + thiz.getName() + "]"); + if ((raf.readShort() & 0x0080) != 0) throw new ZipException("bug #9695860 [" + thiz.getName() + "]"); } -- 2.47.2