You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stefan Bodewig (JIRA)" <ji...@apache.org> on 2015/06/09 06:20:00 UTC

[jira] [Resolved] (COMPRESS-317) ArrayIndexOutOfBoundsException in ZipArchiveEntry.getMergedFields()

     [ https://issues.apache.org/jira/browse/COMPRESS-317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Bodewig resolved COMPRESS-317.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.10

Thanks!

fixed with svn revision 1684309, will port it to Ant.

> ArrayIndexOutOfBoundsException in ZipArchiveEntry.getMergedFields()
> -------------------------------------------------------------------
>
>                 Key: COMPRESS-317
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-317
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>            Reporter: Lucas Werkmeister
>            Priority: Minor
>              Labels: easyfix
>             Fix For: 1.10
>
>
> {{src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java}} contains the following at line 380 in {{getMergedFields()}}:
> {code:java}
> zipExtraFields[zipExtraFields.length] = unparseableExtra;
> {code}
> This will cause an {{ArrayIndexOutOfBoundsException}} when reached.
> Note that Apache Ant inherited this bug with commit [{{2c04d7e}}|https://git-wip-us.apache.org/repos/asf?p=ant.git;a=commitdiff;h=2c04d7e833b4e5dab1a3c5ddfe14b572aea8c112], which is where I found it; a fix should be ported there too. (The class is called just {{ZipEntry}} there; full path: {{src/main/org/apache/tools/zip/ZipEntry.java}})
> The correct line is probably one of the following:
> {code:java}
> zipExtraFields[zipExtraFields.length - 1] = unparseableExtra;
> zipExtraFields[extraFields.length] = unparseableExtra;
> {code}
> They should be equivalent because of the line immediately above line 380, which creates {{zipExtraFields}} as copy of {{extraFields}} that is one element longer. It might be worth noting that line 411 of {{ZipArchiveEntry}} uses {{zipExtraFields.length - 1}}, while line 411 of Ant's {{ZipEntry}} uses {{extraFields.length}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)