commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (JIRA)" <>
Subject [jira] [Commented] (COMPRESS-380) Support for ENHANCED_DEFLATED (Deflate64) in ZIP files
Date Sun, 07 Jan 2018 20:16:00 GMT


Dawid Weiss commented on COMPRESS-380:

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

{{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:

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

because the spec says: 

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

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:
>             Project: Commons Compress
>          Issue Type: New Feature
>            Reporter: Dawid Weiss
>             Fix For: 1.16
>         Attachments:,,,,
compress-380.diff,, 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).

This message was sent by Atlassian JIRA

View raw message