]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
zip: fix writing with ZSTD compression 2670/head
authorBenoit Pierre <benoit.pierre@gmail.com>
Sat, 7 Jun 2025 22:30:14 +0000 (00:30 +0200)
committerBenoit Pierre <benoit.pierre@gmail.com>
Mon, 21 Jul 2025 09:35:27 +0000 (11:35 +0200)
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.

libarchive/archive_write_set_format_zip.c

index 79bbf0335e370f9b1a5366ba0030264a0d3bb532..19121b5191481fa24119a1b5a58bc08e6cca7f6a 100644 (file)
@@ -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;