commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lucas Werkmeister (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COMPRESS-317) ArrayIndexOutOfBoundsException in ZipArchiveEntry.getMergedFields()
Date Tue, 09 Jun 2015 15:09:00 GMT

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

Lucas Werkmeister commented on COMPRESS-317:
--------------------------------------------

Great, thanks!

> 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)

Mime
View raw message