[
https://issues.apache.org/jira/browse/COMPRESS-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17009693#comment-17009693
]
Anvesh Mora commented on COMPRESS-494:
--------------------------------------
I also noticed some strange way of handling setSize method in special version
jar in readDataDescriptor method:
{code:java}
if (!potentialSig.equals(ZipLong.CFH_SIG) &&
!potentialSig.equals(ZipLong.LFH_SIG)) {
this.current.entry.setCompressedSize(ZipEightByteInteger.getLongValue(this.twoDwordBuf));
System.err.println("Setting size from Zip64 Data Descriptor, size
is: " + ZipEightByteInteger.getLongValue(this.twoDwordBuf, 8) + ", as BigInt "
+ ZipEightByteInteger.getValue(this.twoDwordBuf, 8));
this.current.entry.setSize(ZipEightByteInteger.getLongValue(this.twoDwordBuf,
8));
} else {
this.pushback(this.twoDwordBuf, 8, 8);
this.current.entry.setCompressedSize(ZipLong.getValue(this.twoDwordBuf));
System.err.println("Setting size from Data Descriptor, size is: " +
ZipLong.getValue(this.twoDwordBuf, 4));
this.current.entry.setSize(ZipLong.getValue(this.twoDwordBuf, 4));
}
{code}
unlike in released jar(1.9/1.18) it has:
{code:java}
if ((potentialSig.equals(ZipLong.CFH_SIG)) ||
(potentialSig.equals(ZipLong.LFH_SIG)))
{
pushback(this.TWO_DWORD_BUF, 8, 8);
this.current.entry.setCompressedSize(ZipLong.getValue(this.TWO_DWORD_BUF));
this.current.entry.setSize(ZipLong.getValue(this.TWO_DWORD_BUF, 4));
}
else
{
this.current.entry.setCompressedSize(ZipEightByteInteger.getLongValue(this.TWO_DWORD_BUF));
this.current.entry.setSize(ZipEightByteInteger.getLongValue(this.TWO_DWORD_BUF,
8));
}
{code}
*Observe that how setSize method is being call with different offset in
if-else statements.*
Above special version code is not throwing invalid entry size but throwing EOF
exception in GzipCompressorInputStream but in 1.9/1.8 it throwing invalid entry
size exception in ZipArchiveEntry.
> ZipArchieveInputStream component is throwing "Invalid Entry Size"
> -----------------------------------------------------------------
>
> Key: COMPRESS-494
> URL: https://issues.apache.org/jira/browse/COMPRESS-494
> Project: Commons Compress
> Issue Type: Bug
> Affects Versions: 1.8, 1.18
> Reporter: Anvesh Mora
> Priority: Critical
> Attachments: commons-compress-1.20-SNAPSHOT.jar
>
>
> I've observed in my development in certain zip files which we are able to
> extract with with unzip utility on linux is failing with our Compress library.
>
> As of now I've stack-trace to share, I'm gonna add more in here as on when
> discussion begins on this:
>
> {code:java}
> Caused by: java.lang.IllegalArgumentException: invalid entry size
> at
> org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
> at
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
> nputStream.java:702)
> at
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
> hiveInputStream.java:805)
> at
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
> tStream.java:758)
> at
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
> am.java:407)
> at
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
> a:382)
> {code}
> I missed to add version info, below are those:
> version of lib I'm using is: 1.9
> And I did try version 1.18, issue is observed in this version too.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)