go-zopfli icon indicating copy to clipboard operation
go-zopfli copied to clipboard

Invalid output on empty files

Open tarndt opened this issue 8 years ago • 3 comments
trafficstars

zopfli.GzipCompress will return garbage if the input is 0 bytes long.

./testprog | zcat
gzip: out.gz: invalid compressed data--format violated

tarndt avatar Jun 20 '17 22:06 tarndt

It will panic if the input is 1 bytes long.

./testprog | zcat 
panic: runtime error: index out of range

tarndt avatar Jun 20 '17 22:06 tarndt

I have a zopfli_test.go file that shows the problem and a fix for one of the cases.

jeffallen avatar Jun 21 '17 08:06 jeffallen

@jeffallen @foobaz I was surprised to see this was still broken. Can we merge https://github.com/foobaz/go-zopfli/pull/3 to fix?

tarndt avatar Jan 03 '20 19:01 tarndt