[ 
https://issues.apache.org/jira/browse/COMPRESS-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16319857#comment-16319857
 ] 

Stefan Bodewig commented on COMPRESS-380:
-----------------------------------------

There is an additional danger when we add buffering inside of the compressor 
streams unconditionally: we may read too far.

Take DEFLATE64, {{ZipArchiveInputStream}} and the case where a data descriptor 
is used as an example. 
https://github.com/apache/commons-compress/blob/master/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java#L347

When the deflater has found the "end of stream" marker it will return -1 and we 
are done. An additional {{BufferedInputStream}} may have consumed additional 
bytes from the original ZIP stream that we would now need to "push back" into 
the original stream so the rest of the archive can be read properly.

Having multiple consecutive streams isn't that uncommon (multiple attachments 
of an email, for example) that's why we need the caller to be able to control 
things.

COMPRESS-438 is a completely different case and I fully agree with it.

> Support for ENHANCED_DEFLATED (Deflate64) in ZIP files
> ------------------------------------------------------
>
>                 Key: COMPRESS-380
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-380
>             Project: Commons Compress
>          Issue Type: New Feature
>            Reporter: Dawid Weiss
>             Fix For: 1.16
>
>         Attachments: archive-deflate.zip, archive-deflate64.zip, archive.zip, 
> archive64.zip, compress-380.diff, hello.world, input2
>
>
> Some of the (large) ZIP files we try to process currently will throw this:
> {code}
> UnsupportedZipFeatureException: unsupported feature method 
> 'ENHANCED_DEFLATED' 
> {code}
> which is a bummer since JDK's implementation also doesn't support Deflate64. 
> This seems to be PKWare's extensions, although code to decrypt it exists in 
> zlib (and is appropriately licensed, I believe).
> https://github.com/madler/zlib/tree/master/contrib/infback9



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to