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

Dawid Weiss commented on COMPRESS-380:
--------------------------------------

Hi Stefan. Seems to be this assertion causing this particular problem:
{code}
            if (memory[start] == -1) {
                throw new IllegalStateException("Attempt to read beyond memory: 
dist=" + distance);
            }
{code}

{{memory}} is a byte array so {{0xff}} will trip this. I commented it out and 
the test passes then. I'd remove this check entirely (and Array.fill(-1) too).

There are still plenty of other exceptions. For example the non-compressed 
block header fails to verify on len/nlen equality. I think this condition is 
wrong:

{code}
                        case 0:
                            readBits(Byte.SIZE - 3);
{code}

because the spec says: 

{code}
Any bits of input up to the next byte boundary are ignored.
{code}

and while it is true on the first block, it may not be on subsequent blocks (I 
think). The bit reader would have to be able to align to a byte boundary here.

I didn't check for other errors (there's still quite a few of them), but the 
above is definitely a start for looking deeper.

> 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