Closed tjj5036 closed 7 years ago
If you create a file like so:
$ for i in `seq 1 100`; do echo "ASDFASDFASDFASDFASDF" >> foobar; done $ gunzip foobar $ head -c 30 foobar.gz > foobar2.gz
And try and extract it with the following:
package main import ( gzip "github.com/klauspost/pgzip" "io" "os" ) func main() { badDataReader, err := os.Open("foobar2.gz") if err != nil { os.Exit(1) } gzipReader, err := gzip.NewReader(badDataReader) if err != nil { os.Exit(1) } _, err = io.Copy(os.Stdout, gzipReader) if err != nil { os.Exit(2) } }
pgzip will indefinitely hang, however using compress/gzip will correctly error out.
pgzip
compress/gzip
If you create a file like so:
And try and extract it with the following:
pgzip
will indefinitely hang, however usingcompress/gzip
will correctly error out.