diff --git a/go.mod b/go.mod index 58108cf1f..064e95c1e 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/klauspost/compress v1.9.4 github.com/valyala/fastjson v1.4.1 github.com/valyala/fastrand v1.0.0 - github.com/valyala/gozstd v1.6.3 + github.com/valyala/gozstd v1.6.4 github.com/valyala/histogram v1.0.1 github.com/valyala/quicktemplate v1.4.1 go.opencensus.io v0.22.2 // indirect diff --git a/go.sum b/go.sum index df3b0349a..5443e02ca 100644 --- a/go.sum +++ b/go.sum @@ -101,8 +101,8 @@ github.com/valyala/fastjson v1.4.1 h1:hrltpHpIpkaxll8QltMU8c3QZ5+qIiCL8yKqPFJI/y github.com/valyala/fastjson v1.4.1/go.mod h1:nV6MsjxL2IMJQUoHDIrjEI7oLyeqK6aBD7EFWPsvP8o= github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI= github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ= -github.com/valyala/gozstd v1.6.3 h1:kr3oF/F1RvxYr8wgPjrH04gvHuMEL99pPC9e+5pPQdU= -github.com/valyala/gozstd v1.6.3/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ= +github.com/valyala/gozstd v1.6.4 h1:nFLddjEf90SFl5cVWyElSHozQDsbvLljPK703/skBS0= +github.com/valyala/gozstd v1.6.4/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ= github.com/valyala/histogram v1.0.1 h1:FzA7n2Tz/wKRMejgu3PV1vw3htAklTjjuoI6z3d4KDg= github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto= github.com/valyala/quicktemplate v1.4.1 h1:tEtkSN6mTCJlYVT7As5x4wjtkk2hj2thsb0M+AcAVeM= diff --git a/vendor/github.com/valyala/gozstd/gozstd.go b/vendor/github.com/valyala/gozstd/gozstd.go index c0e0f966c..477508d40 100644 --- a/vendor/github.com/valyala/gozstd/gozstd.go +++ b/vendor/github.com/valyala/gozstd/gozstd.go @@ -122,9 +122,7 @@ func compress(cctx, cctxDict *cctxWrapper, dst, src []byte, cd *CDict, compressi dstLen := len(dst) if cap(dst) > dstLen { // Fast path - try compressing without dst resize. - dst = dst[:cap(dst)] - - result := compressInternal(cctx, cctxDict, dst[dstLen:], src, cd, compressionLevel, false) + result := compressInternal(cctx, cctxDict, dst[dstLen:cap(dst)], src, cd, compressionLevel, false) compressedSize := int(result) if compressedSize >= 0 { // All OK. @@ -143,9 +141,8 @@ func compress(cctx, cctxDict *cctxWrapper, dst, src []byte, cd *CDict, compressi // This should be optimized since go 1.11 - see https://golang.org/doc/go1.11#performance-compiler. dst = append(dst[:cap(dst)], make([]byte, n)...) } - dst = dst[:dstLen+compressBound] - result := compressInternal(cctx, cctxDict, dst[dstLen:], src, cd, compressionLevel, true) + result := compressInternal(cctx, cctxDict, dst[dstLen:dstLen+compressBound], src, cd, compressionLevel, true) compressedSize := int(result) return dst[:dstLen+compressedSize] } @@ -247,9 +244,7 @@ func decompress(dctx, dctxDict *dctxWrapper, dst, src []byte, dd *DDict) ([]byte dstLen := len(dst) if cap(dst) > dstLen { // Fast path - try decompressing without dst resize. - dst = dst[:cap(dst)] - - result := decompressInternal(dctx, dctxDict, dst[dstLen:], src, dd) + result := decompressInternal(dctx, dctxDict, dst[dstLen:cap(dst)], src, dd) decompressedSize := int(result) if decompressedSize >= 0 { // All OK. @@ -279,9 +274,8 @@ func decompress(dctx, dctxDict *dctxWrapper, dst, src []byte, dd *DDict) ([]byte // This should be optimized since go 1.11 - see https://golang.org/doc/go1.11#performance-compiler. dst = append(dst[:cap(dst)], make([]byte, n)...) } - dst = dst[:dstLen+decompressBound] - result := decompressInternal(dctx, dctxDict, dst[dstLen:], src, dd) + result := decompressInternal(dctx, dctxDict, dst[dstLen:dstLen+decompressBound], src, dd) decompressedSize := int(result) if decompressedSize >= 0 { // All OK. diff --git a/vendor/modules.txt b/vendor/modules.txt index 56ab9e24a..4ac7933dd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -95,7 +95,7 @@ github.com/valyala/fastjson github.com/valyala/fastjson/fastfloat # github.com/valyala/fastrand v1.0.0 github.com/valyala/fastrand -# github.com/valyala/gozstd v1.6.3 +# github.com/valyala/gozstd v1.6.4 github.com/valyala/gozstd # github.com/valyala/histogram v1.0.1 github.com/valyala/histogram