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
