Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.20
-
None
-
None
Description
The following snippet of code throws an undeclared IllegalArgumentException:
byte[] bytes = Base64.getDecoder().decode("UEsFBgAAAQD//////////1AAJP9QAA=="); SeekableInMemoryByteChannel input = new SeekableInMemoryByteChannel(bytes); try { ZipFile file = new ZipFile(input); } catch (IOException ignored) {}
The stack trace is:
java.lang.IllegalArgumentException: Position has to be in range 0.. 2147483647 at org.apache.commons.compress.utils.SeekableInMemoryByteChannel.position(SeekableInMemoryByteChannel.java:94) at org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory32(ZipFile.java:1128) at org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:1037) at org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:702) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:371) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:318) at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:274)
I also attached the input as a ZIP file.