log4j-detector icon indicating copy to clipboard operation
log4j-detector copied to clipboard

java.util.zip.ZipException: invalid entry size (expected 0 but got 622 bytes)

Open Andreas-Schniertshauer opened this issue 2 years ago • 4 comments

I get various messages java.util.zip.ZipException: invalid entry size (expected 0 but got 622 bytes) when e.g. scanning the following zip file: https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7Samples/dataaccess/OPC/musicbundlesignature/SampleMusicBundle.zip

With 7-Zip I can open it.

Andreas-Schniertshauer avatar Dec 21 '21 13:12 Andreas-Schniertshauer

And problem message unzip610c22.zip!/unzip610c22/testmake_ppmd.zip - java.util.zip.ZipException: invalid compression method e.g. http://antinode.info/ftp/info-zip/unzip610c22.zip : invalid compression method java.util.zip.ZipException: invalid compression method at java.base/java.util.zip.ZipInputStream.read(ZipInputStream.java:226) at java.base/java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:141) at java.base/java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:119) at com.mergebase.log4j.Log4JDetector.findLog4jRecursive(Log4JDetector.java:283) at com.mergebase.log4j.Log4JDetector.findLog4jRecursive(Log4JDetector.java:362) at com.mergebase.log4j.Log4JDetector.scan(Log4JDetector.java:590) at com.mergebase.log4j.Log4JDetector.analyze(Log4JDetector.java:697) at com.mergebase.log4j.Log4JDetector.main(Log4JDetector.java:155)

Andreas-Schniertshauer avatar Dec 21 '21 13:12 Andreas-Schniertshauer

What does "java -version" print out?

juliusmusseau avatar Dec 21 '21 20:12 juliusmusseau

openjdk 11.0.13 2021-10-19 OpenJDK Runtime Environment Temurin-11.0.13+8 (build 11.0.13+8) OpenJDK 64-Bit Server VM Temurin-11.0.13+8 (build 11.0.13+8, mixed mode)

Andreas-Schniertshauer avatar Dec 22 '21 08:12 Andreas-Schniertshauer

Reproducible on:

java -version
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment 18.9 (build 11.0.13+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing)

Stack trace from 2021-12-22:

$ java -jar log4j-detector-2021.12.22.jar --verbose SampleMusicBundle.zip 
-- github.com/mergebase/log4j-detector v2021.12.22 (by mergebase.com) analyzing paths (could take a while).
-- Note: specify the '--verbose' flag to have every file examined printed to STDERR.
-- Examining /tmp/SampleMusicBundle.zip... 
-- Problem /tmp/SampleMusicBundle.zip - java.util.zip.ZipException: invalid entry size (expected 0 but got 622 bytes)
java.util.zip.ZipException: invalid entry size (expected 0 but got 622 bytes)
	at java.base/java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:400)
	at java.base/java.util.zip.ZipInputStream.read(ZipInputStream.java:199)
	at java.base/java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:143)
	at java.base/java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:121)
	at com.mergebase.log4j.Log4JDetector.findLog4jRecursive(Log4JDetector.java:291)
	at com.mergebase.log4j.Log4JDetector.scan(Log4JDetector.java:617)
	at com.mergebase.log4j.Log4JDetector.analyze(Log4JDetector.java:724)
	at com.mergebase.log4j.Log4JDetector.main(Log4JDetector.java:160)

There's a StackOverfow question with this exact error and no answers; it could be related to a specific Zip format.

rgmz avatar Dec 22 '21 20:12 rgmz