summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorPaulo Casanova <pasc@google.com>2017-04-20 18:25:25 +0100
committerPaulo Casanova <pasc@google.com>2017-04-21 15:23:37 +0100
commit0ab7865e6f1e5d7a01d292bbd33cd2204cb55b9a (patch)
treefb52f6439f8d9c8965ebf14c67ec416cc6b1aa8d /src/main/java
parent2114d2f8f540b6634c9431d80adac4960fefba07 (diff)
downloadapkzlib-0ab7865e6f1e5d7a01d292bbd33cd2204cb55b9a.tar.gz
Fixed bug in ZFile that did not allow RO open.
When opening a V2 signed APK, ZFile would force the file to be marked "dirty" when setting the extra offset for the central directory required by V2 signature. This would force the zip to be written. Test: included Change-Id: I799c1b7dd3a927591e9d3ed410494bfa0b33300b
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/android/apkzlib/zip/ZFile.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/com/android/apkzlib/zip/ZFile.java b/src/main/java/com/android/apkzlib/zip/ZFile.java
index 396d8ac..d86a3c5 100644
--- a/src/main/java/com/android/apkzlib/zip/ZFile.java
+++ b/src/main/java/com/android/apkzlib/zip/ZFile.java
@@ -580,9 +580,13 @@ public class ZFile implements Closeable {
entryEndOffset = 0;
}
+ /*
+ * Check if there is an extra central directory offset. If there is, save it. Note that
+ * we can't call extraDirectoryOffset() because that would mark the file as dirty.
+ */
long extraOffset = directoryStartOffset - entryEndOffset;
Verify.verify(extraOffset >= 0, "extraOffset (%s) < 0", extraOffset);
- setExtraDirectoryOffset(extraOffset);
+ extraDirectoryOffset = extraOffset;
}
/**