bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gzip test file+1byte gives unexpected end of file


From: Rob J. Epping
Subject: gzip test file+1byte gives unexpected end of file
Date: Fri, 10 May 2013 15:51:36 +0200

Hi,

While fiddling around with some firmware images I ran into this bug.
Basically I was trying to binary search for the end of the gzip part
but the search was always of.

When the input to gunzip is zip-size+1byte long gunzip always returns
"unexpected end of file" instead of "decompression OK, trailing
garbage ignored"

I'm not enough of a programmer to find out what the cause is.
What is going on here and can it be fixed?

Tested it on gzip 1.3.3 (redhat/amd64), gzip 1.3.12 (debian/amd64) and
gzip 1.5 (debian/armel and ubuntu/amd64) and all have the same result.

Here is how to reproduce:

# create empty .gz (20 bytes)
: | gzip > test.gz

# extend with arbitrary bytes; /dev/zero also works
dd if=/dev/urandom bs=1 count=77 >> test.gz

# extract 22 bytes and test; expected result
dd if=test.gz count=1 bs=22 > x.gz
gunzip -tv x.gz

res> x.gz:
res> gzip: x.gz: decompression OK, trailing garbage ignored
res> OK

# extract 21 bytes and test; unexpected result
dd if=test.gz count=1 bs=21 > x.gz
gunzip -tv x.gz

res> x.gz:
res> gzip: x.gz: unexpected end of file

# extract 20 bytes and test; unexpected result
dd if=test.gz count=1 bs=20 > x.gz
gunzip -tv x.gz

res> x.gz: OK
--
GRTNX,
RobJE



reply via email to

[Prev in Thread] Current Thread [Next in Thread]