Zbynek Vyskovsky created COMPRESS-653:
-----------------------------------------

             Summary: ZipArchiveOutputStream multi archive updates metadata in 
incorrect file
                 Key: COMPRESS-653
                 URL: https://issues.apache.org/jira/browse/COMPRESS-653
             Project: Commons Compress
          Issue Type: Bug
          Components: Archivers
    Affects Versions: 1.25.0
            Reporter: Zbynek Vyskovsky


`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.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to