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

Gary D. Gregory commented on COMPRESS-653:
------------------------------------------

Hello [~kvr] 

Thank you for taking the time to write this report.

Feel free to provide a PR on GitHub with a matching test or tests.

> 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
>            Priority: Major
>
> `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