Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-317

ArrayIndexOutOfBoundsException in ZipArchiveEntry.getMergedFields()

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.10
    • Component/s: Archivers
    • Labels:

      Description

      src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java contains the following at line 380 in getMergedFields():

      zipExtraFields[zipExtraFields.length] = unparseableExtra;
      

      This will cause an ArrayIndexOutOfBoundsException when reached.

      Note that Apache Ant inherited this bug with commit 2c04d7e, 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:

      zipExtraFields[zipExtraFields.length - 1] = unparseableExtra;
      zipExtraFields[extraFields.length] = unparseableExtra;
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lucaswerkmeister Lucas Werkmeister
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: