diff options
Diffstat (limited to 'vendor/github.com/pierrec')
7 files changed, 32 insertions, 44 deletions
diff --git a/vendor/github.com/pierrec/lz4/v4/.gitignore b/vendor/github.com/pierrec/lz4/v4/.gitignore index 5e98735047..5d7e88de0a 100644 --- a/vendor/github.com/pierrec/lz4/v4/.gitignore +++ b/vendor/github.com/pierrec/lz4/v4/.gitignore @@ -31,4 +31,6 @@ Temporary Items # End of https://www.gitignore.io/api/macos cmd/*/*exe -.idea
\ No newline at end of file +.idea + +fuzz/*.zip diff --git a/vendor/github.com/pierrec/lz4/v4/.travis.yml b/vendor/github.com/pierrec/lz4/v4/.travis.yml deleted file mode 100644 index 4a9819e03a..0000000000 --- a/vendor/github.com/pierrec/lz4/v4/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: go - -env: - - GO111MODULE=off - -go: - - 1.13.x - - 1.14.x - -matrix: - fast_finish: true - -sudo: false - -script: - - go test -v -cpu=2 - - go test -v -cpu=2 -race - - go test -v -cpu=2 -tags noasm - - go test -v -cpu=2 -race -tags noasm diff --git a/vendor/github.com/pierrec/lz4/v4/README.md b/vendor/github.com/pierrec/lz4/v4/README.md index 4ee388e81b..df027e2c30 100644 --- a/vendor/github.com/pierrec/lz4/v4/README.md +++ b/vendor/github.com/pierrec/lz4/v4/README.md @@ -1,7 +1,7 @@ # lz4 : LZ4 compression in pure Go -[![GoDoc](https://godoc.org/github.com/pierrec/lz4?status.svg)](https://godoc.org/github.com/pierrec/lz4) -[![Build Status](https://travis-ci.org/pierrec/lz4.svg?branch=master)](https://travis-ci.org/pierrec/lz4) +[![Go Reference](https://pkg.go.dev/badge/github.com/pierrec/lz4/v4.svg)](https://pkg.go.dev/github.com/pierrec/lz4/v4) +[![CI](https://github.com/pierrec/lz4/workflows/ci/badge.svg)](https://github.com/pierrec/lz4/actions) [![Go Report Card](https://goreportcard.com/badge/github.com/pierrec/lz4)](https://goreportcard.com/report/github.com/pierrec/lz4) [![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/pierrec/lz4.svg?style=social)](https://github.com/pierrec/lz4/tags) @@ -15,13 +15,13 @@ The implementation is based on the reference C [one](https://github.com/lz4/lz4) Assuming you have the go toolchain installed: ``` -go get github.com/pierrec/lz4 +go get github.com/pierrec/lz4/v4 ``` There is a command line interface tool to compress and decompress LZ4 files. ``` -go install github.com/pierrec/lz4/cmd/lz4c +go install github.com/pierrec/lz4/v4/cmd/lz4c ``` Usage diff --git a/vendor/github.com/pierrec/lz4/v4/go.sum b/vendor/github.com/pierrec/lz4/v4/go.sum index 6973bd668a..e69de29bb2 100644 --- a/vendor/github.com/pierrec/lz4/v4/go.sum +++ b/vendor/github.com/pierrec/lz4/v4/go.sum @@ -1,3 +0,0 @@ -github.com/pierrec/lz4 v1.0.1 h1:w6GMGWSsCI04fTM8wQRdnW74MuJISakuUU0onU0TYB4= -github.com/pierrec/lz4 v2.6.0+incompatible h1:Ix9yFKn1nSPBLFl/yZknTp8TU5G4Ps0JDmguYK6iH1A= -github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= diff --git a/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_arm.s b/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_arm.s index ec94b7b3c3..64be9adcaa 100644 --- a/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_arm.s +++ b/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_arm.s @@ -140,25 +140,22 @@ readMatchlenLoop: BEQ readMatchlenLoop readMatchlenDone: - ADD minMatch, len - - // Bounds check dst+len and match = dst-offset. + // Bounds check dst+len+minMatch and match = dst-offset. ADD dst, len, tmp1 + ADD minMatch, tmp1 CMP dstend, tmp1 //BHI shortDst // Uncomment for distinct error codes. SUB offset, dst, match CMP.LS match, dstorig BHI corrupt - // If the offset is at least four (len is, because of minMatch), - // do a four-way unrolled byte copy loop. Using MOVD instead of four - // byte loads is much faster, but to remain portable we'd have to - // align match first, which in turn is too expensive. - CMP $4, offset - BLO copyMatch - - SUB $4, len + // Since len+minMatch is at least four, we can do a 4× unrolled + // byte copy loop. Using MOVW instead of four byte loads is faster, + // but to remain portable we'd have to align match first, which is + // too expensive. By alternating loads and stores, we also handle + // the case offset < 4. copyMatch4: + SUB.S $4, len MOVBU.P 4(match), tmp1 MOVB.P tmp1, 4(dst) MOVBU -3(match), tmp2 @@ -167,7 +164,6 @@ copyMatch4: MOVB tmp3, -2(dst) MOVBU -1(match), tmp1 MOVB tmp1, -1(dst) - SUB.S $4, len BPL copyMatch4 // Restore len, which is now negative. @@ -175,7 +171,7 @@ copyMatch4: BEQ copyMatchDone copyMatch: - // Simple byte-at-a-time copy. + // Finish with a byte-at-a-time copy. SUB.S $1, len MOVBU.P 1(match), tmp2 MOVB.P tmp2, 1(dst) diff --git a/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go b/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go index 9065653a9f..52df2f2b8e 100644 --- a/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go +++ b/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go @@ -2,7 +2,13 @@ package lz4block +import "encoding/binary" + func decodeBlock(dst, src []byte) (ret int) { + // Restrict capacities so we don't read or write out of bounds. + dst = dst[:len(dst):len(dst)] + src = src[:len(src):len(src)] + const hasError = -2 defer func() { if recover() != nil { @@ -32,7 +38,7 @@ func decodeBlock(dst, src []byte) (ret int) { // if the match length (4..18) fits within the literals, then copy // all 18 bytes, even if not all are part of the literals. mLen += 4 - if offset := uint(src[si]) | uint(src[si+1])<<8; mLen <= offset { + if offset := u16(src[si:]); mLen <= offset { i := di - offset end := i + 18 if end > uint(len(dst)) { @@ -66,7 +72,7 @@ func decodeBlock(dst, src []byte) (ret int) { return hasError } - offset := uint(src[si]) | uint(src[si+1])<<8 + offset := u16(src[si:]) if offset == 0 { return hasError } @@ -98,3 +104,5 @@ func decodeBlock(dst, src []byte) (ret int) { di += uint(copy(dst[di:di+mLen], expanded[:mLen])) } } + +func u16(p []byte) uint { return uint(binary.LittleEndian.Uint16(p)) } diff --git a/vendor/github.com/pierrec/lz4/v4/internal/lz4stream/block.go b/vendor/github.com/pierrec/lz4/v4/internal/lz4stream/block.go index 279a8cc493..c7b929fdfe 100644 --- a/vendor/github.com/pierrec/lz4/v4/internal/lz4stream/block.go +++ b/vendor/github.com/pierrec/lz4/v4/internal/lz4stream/block.go @@ -67,8 +67,9 @@ func (b *Blocks) close(f *Frame, num int) error { return err } if b.Blocks == nil { - // Not initialized yet. - return nil + err := b.err + b.err = nil + return err } c := make(chan *FrameDataBlock) b.Blocks <- c @@ -114,15 +115,18 @@ func (b *Blocks) initR(f *Frame, num int, src io.Reader) (chan []byte, error) { block := NewFrameDataBlock(f) cumx, err = block.Read(f, src, 0) if err != nil { + block.Close(f) break } // Recheck for an error as reading may be slow and uncompressing is expensive. if b.ErrorR() != nil { + block.Close(f) break } c := make(chan []byte) blocks <- c go func() { + defer block.Close(f) data, err := block.Uncompress(f, size.Get(), false) if err != nil { b.closeR(err) |