Update dependencies and replace uuid library (#100)

This commit is contained in:
Joona Hoikkala
2018-08-10 16:51:32 +03:00
committed by GitHub
parent 8aa869b2f8
commit 75d4a30c1f
1771 changed files with 103824 additions and 39288 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ func ExampleReader_Multistream() {
log.Fatal(err)
}
fmt.Println("\n")
fmt.Print("\n\n")
err = zr.Reset(&buf)
if err == io.EOF {
+1 -1
View File
@@ -10,11 +10,11 @@ import (
"bufio"
"encoding/binary"
"errors"
"hash/crc32"
"io"
"time"
"github.com/klauspost/compress/flate"
"github.com/klauspost/crc32"
)
const (
+34
View File
@@ -680,3 +680,37 @@ func BenchmarkGunzipStdlib(b *testing.B) {
}
}
}
func TestTruncatedGunzip(t *testing.T) {
in := []byte(strings.Repeat("ASDFASDFASDFASDFASDF", 1000))
var buf bytes.Buffer
enc := NewWriter(&buf)
_, err := enc.Write(in)
if err != nil {
t.Fatal(err)
}
enc.Close()
testdata := buf.Bytes()
for i := 5; i < len(testdata); i += 10 {
timer := time.NewTimer(time.Second)
done := make(chan struct{})
fail := make(chan struct{})
go func() {
r, err := NewReader(bytes.NewBuffer(testdata[:i]))
if err == nil {
b, err := ioutil.ReadAll(r)
if err == nil && !bytes.Equal(testdata[:i], b) {
close(fail)
}
}
close(done)
}()
select {
case <-timer.C:
t.Fatal("Timeout decoding")
case <-fail:
t.Fatal("No error, but mismatch")
case <-done:
timer.Stop()
}
}
}
+1 -1
View File
@@ -7,10 +7,10 @@ package gzip
import (
"errors"
"fmt"
"hash/crc32"
"io"
"github.com/klauspost/compress/flate"
"github.com/klauspost/crc32"
)
// These constants are copied from the flate package, so that code that imports