Subject: Re: bin/32933: gzip -tv reports (some?) truncated files as OK
To: None <mlelstv@NetBSD.org, gnats-admin@netbsd.org,>
From: Michael van Elst <mlelstv@serpens.de>
List: netbsd-bugs
Date: 10/09/2006 07:30:02
The following reply was made to PR bin/32933; it has been noted by GNATS.
From: Michael van Elst <mlelstv@serpens.de>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/32933: gzip -tv reports (some?) truncated files as OK
Date: Mon, 9 Oct 2006 09:27:15 +0200
The following patch will cause gzip to abort decompression with
an error, when EOF is reached on input. The test output will then
be 'NOT OK'.
Index: gzip.c
===================================================================
RCS file: /cvsroot/src/usr.bin/gzip/gzip.c,v
retrieving revision 1.85
diff -u -r1.85 gzip.c
--- gzip.c 27 Sep 2006 22:20:31 -0000 1.85
+++ gzip.c 9 Oct 2006 06:58:23 -0000
@@ -743,9 +743,11 @@
in_tot += in_size;
}
if (z.avail_in == 0) {
- if (done_reading && state != GZSTATE_MAGIC0)
+ if (done_reading && state != GZSTATE_MAGIC0) {
maybe_warnx("%s: unexpected end of file",
filename);
+ goto stop_and_fail;
+ }
goto stop;
}
switch (state) {
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."