summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <fork@madler.net>2022-07-24 11:39:49 -0700
committerMark Adler <fork@madler.net>2022-07-24 11:39:49 -0700
commite9c0bbbc4f6710c4e19dd1c3b4b6405116ce26d0 (patch)
treeddc6ba98a289d47a836b9194ef4d737d3398bc4d
parente1fa51ca99a851febe2b00632f3ba417d30f8a6c (diff)
downloadpigz-e9c0bbbc4f6710c4e19dd1c3b4b6405116ce26d0.tar.gz
Write all available uncompressed output upon encountering an error.
-rw-r--r--pigz.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pigz.c b/pigz.c
index ce17dfa..e1c60b6 100644
--- a/pigz.c
+++ b/pigz.c
@@ -3485,6 +3485,9 @@ local void infchk(void) {
strm.next_in = Z_NULL;
ret = inflateBack(&strm, inb, NULL, outb, NULL);
inflateBackEnd(&strm);
+ g.in_left += strm.avail_in;
+ g.in_next = strm.next_in;
+ outb(NULL, NULL, 0); // finish off final write and check
if (ret == Z_DATA_ERROR)
throw(EDOM, "%s: corrupted -- invalid deflate data (%s)",
g.inf, strm.msg);
@@ -3492,9 +3495,6 @@ local void infchk(void) {
throw(EDOM, "%s: corrupted -- incomplete deflate data", g.inf);
if (ret != Z_STREAM_END)
throw(EINVAL, "internal error");
- g.in_left += strm.avail_in;
- g.in_next = strm.next_in;
- outb(NULL, NULL, 0); // finish off final write and check
// compute compressed data length
clen = g.in_tot - g.in_left;