Skip to content

Commit 1493d9d

Browse files
authored
fix: opt out of stricter java rules for zip64 and dot entries (#3178)
* fix: opt out of stricter java rules for zip64 and dot entries * test: assert specific system properties for test suite
1 parent 3fdc06a commit 1493d9d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ public static void main(String[] args) throws BrutException {
4242
// headless
4343
System.setProperty("java.awt.headless", "true");
4444

45+
// Ignore stricter validation on zip files from java 11 onwards as this is a protection technique
46+
// that applications use to thwart disassembly tools. We have protections in place for directory traversal
47+
// and handling of bogus data in the zip header, so we can ignore this.
48+
System.setProperty("jdk.nio.zipfs.allowDotZipEntry", "true");
49+
System.setProperty("jdk.util.zip.disableZip64ExtraFieldValidation", "true");
50+
4551
// set verbosity default
4652
Verbosity verbosity = Verbosity.NORMAL;
4753

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ subprojects {
142142
apply plugin: 'java'
143143

144144
test {
145+
// https://github.com/iBotPeaches/Apktool/issues/3174
146+
systemProperty 'jdk.nio.zipfs.allowDotZipEntry', 'true'
147+
systemProperty 'jdk.util.zip.disableZip64ExtraFieldValidation', 'true'
148+
145149
testLogging {
146150
exceptionFormat = 'full'
147151
}

0 commit comments

Comments
 (0)