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

ZipArchiveOutputStream multi archive updates metadata in incorrect file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.25.0
    • 1.26.0
    • Archivers
    • None

    Description

      `ZipArchiveOutputStream` fails to update metadata (compressed size, CRC) when file is split into multiple archives.  The original stream is closed and the metadata is written into currently open channel instead.

      Such archive is then not possible to process with regular zip utility as metadata is incorrect and the data stream may be broken because of incorrectly overwritten content by metadata.

      The issue is in `rewriteSizesAndCrc()` function which uses currently open channel.

      When `addRawArchiveEntry()` and metadata is populated in advance, the produced archive is correct.

      Full fix is more complicated as the archiver needs to keep multiple channels open.  As a quick fix, throwing unsupported operation exception may be sufficient to avoid silent failure.

       

      Attachments

        Issue Links

          Activity

            People

              ggregory Gary D. Gregory
              kvr Zbynek Vyskovsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: