From: Benoit Pierre Date: Sat, 7 Jun 2025 22:30:14 +0000 (+0200) Subject: zip: fix writing with ZSTD compression X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1418af239446bc43790ac0401d5fa7173e12d55;p=thirdparty%2Flibarchive.git zip: fix writing with ZSTD compression When testing the feature with `bsdtar -acf test.zip --options zip:compression=zstd …` on a tree of ~100MB, the execution would appear to "hang" while writing a multi-gigabytes ZIP file. --- diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index 79bbf0335..19121b519 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -1952,10 +1952,11 @@ archive_write_zip_finish_entry(struct archive_write *a) } zip->entry_compressed_written += remainder; zip->written_bytes += remainder; - zip->stream.zstd.out.dst = zip->buf; if (zip->stream.zstd.out.pos != zip->stream.zstd.out.size) finishing = 0; + zip->stream.zstd.out.dst = zip->buf; zip->stream.zstd.out.size = zip->len_buf; + zip->stream.zstd.out.pos = 0; } while (finishing); ZSTD_freeCStream(zip->stream.zstd.context); break;