mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vendor: update github.com/valyala/fastjson from v1.4.1 to v1.4.2
This fixes parsing of `inf` and `nan` values in json lines passed to `/api/v1/import`
This commit is contained in:
parent
a973df6d79
commit
1c436b2723
8 changed files with 58 additions and 7 deletions
2
go.mod
2
go.mod
|
@ -11,7 +11,7 @@ require (
|
|||
github.com/golang/snappy v0.0.1
|
||||
github.com/jstemmer/go-junit-report v0.9.1 // indirect
|
||||
github.com/klauspost/compress v1.9.4
|
||||
github.com/valyala/fastjson v1.4.1
|
||||
github.com/valyala/fastjson v1.4.2
|
||||
github.com/valyala/fastrand v1.0.0
|
||||
github.com/valyala/gozstd v1.6.4
|
||||
github.com/valyala/histogram v1.0.1
|
||||
|
|
4
go.sum
4
go.sum
|
@ -97,8 +97,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
|
|||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s=
|
||||
github.com/valyala/fastjson v1.4.1 h1:hrltpHpIpkaxll8QltMU8c3QZ5+qIiCL8yKqPFJI/yE=
|
||||
github.com/valyala/fastjson v1.4.1/go.mod h1:nV6MsjxL2IMJQUoHDIrjEI7oLyeqK6aBD7EFWPsvP8o=
|
||||
github.com/valyala/fastjson v1.4.2 h1:vJXOwCenHuSyEfxWBUtzZl9LqyfgN2YkaNQBPHHEYbk=
|
||||
github.com/valyala/fastjson v1.4.2/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.4 h1:nFLddjEf90SFl5cVWyElSHozQDsbvLljPK703/skBS0=
|
||||
|
|
15
vendor/github.com/valyala/fastjson/README.md
generated
vendored
15
vendor/github.com/valyala/fastjson/README.md
generated
vendored
|
@ -102,6 +102,21 @@ See also [examples](https://godoc.org/github.com/valyala/fastjson#pkg-examples).
|
|||
* Prefer iterating over array returned from [Value.GetArray](https://godoc.org/github.com/valyala/fastjson#Object.Visit)
|
||||
with a range loop instead of calling `Value.Get*` for each array item.
|
||||
|
||||
## Fuzzing
|
||||
Install [go-fuzz](https://github.com/dvyukov/go-fuzz) & optionally the go-fuzz-corpus.
|
||||
|
||||
```bash
|
||||
go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
|
||||
```
|
||||
|
||||
Build using `go-fuzz-build` and run `go-fuzz` with an optional corpus.
|
||||
|
||||
```bash
|
||||
mkdir -p workdir/corpus
|
||||
cp $GOPATH/src/github.com/dvyukov/go-fuzz-corpus/json/corpus/* workdir/corpus
|
||||
go-fuzz-build github.com/valyala/fastjson
|
||||
go-fuzz -bin=fastjson-fuzz.zip -workdir=workdir
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
|
|
13
vendor/github.com/valyala/fastjson/fastfloat/parse.go
generated
vendored
13
vendor/github.com/valyala/fastjson/fastfloat/parse.go
generated
vendored
|
@ -2,6 +2,7 @@ package fastfloat
|
|||
|
||||
import (
|
||||
"math"
|
||||
"strings"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
@ -132,6 +133,15 @@ func ParseBestEffort(s string) float64 {
|
|||
break
|
||||
}
|
||||
if i <= j {
|
||||
if strings.EqualFold(s[i:], "inf") {
|
||||
if minus {
|
||||
return -inf
|
||||
}
|
||||
return inf
|
||||
}
|
||||
if strings.EqualFold(s[i:], "nan") {
|
||||
return nan
|
||||
}
|
||||
return 0
|
||||
}
|
||||
f := float64(d)
|
||||
|
@ -229,3 +239,6 @@ func ParseBestEffort(s string) float64 {
|
|||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var inf = math.Inf(1)
|
||||
var nan = math.NaN()
|
||||
|
|
22
vendor/github.com/valyala/fastjson/fuzz.go
generated
vendored
Normal file
22
vendor/github.com/valyala/fastjson/fuzz.go
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
// +build gofuzz
|
||||
|
||||
package fastjson
|
||||
|
||||
func Fuzz(data []byte) int {
|
||||
err := ValidateBytes(data)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
v := MustParseBytes(data)
|
||||
|
||||
dst := make([]byte, 0)
|
||||
dst = v.MarshalTo(dst)
|
||||
|
||||
err = ValidateBytes(dst)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return 1
|
||||
}
|
2
vendor/github.com/valyala/fastjson/handy.go
generated
vendored
2
vendor/github.com/valyala/fastjson/handy.go
generated
vendored
|
@ -159,7 +159,7 @@ func ParseBytes(b []byte) (*Value, error) {
|
|||
|
||||
// MustParseBytes parses b containing json.
|
||||
//
|
||||
// The function banics if b cannot be parsed.
|
||||
// The function panics if b cannot be parsed.
|
||||
// The function is slower than the Parser.ParseBytes for re-used Parser.
|
||||
func MustParseBytes(b []byte) *Value {
|
||||
v, err := ParseBytes(b)
|
||||
|
|
5
vendor/github.com/valyala/fastjson/parser.go
generated
vendored
5
vendor/github.com/valyala/fastjson/parser.go
generated
vendored
|
@ -484,8 +484,9 @@ func (o *Object) unescapeKeys() {
|
|||
if o.keysUnescaped {
|
||||
return
|
||||
}
|
||||
for i := range o.kvs {
|
||||
kv := &o.kvs[i]
|
||||
kvs := o.kvs
|
||||
for i := range kvs {
|
||||
kv := &kvs[i]
|
||||
kv.k = unescapeStringBestEffort(kv.k)
|
||||
}
|
||||
o.keysUnescaped = true
|
||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -90,7 +90,7 @@ github.com/klauspost/compress/zstd
|
|||
github.com/klauspost/compress/zstd/internal/xxhash
|
||||
# github.com/valyala/bytebufferpool v1.0.0
|
||||
github.com/valyala/bytebufferpool
|
||||
# github.com/valyala/fastjson v1.4.1
|
||||
# github.com/valyala/fastjson v1.4.2
|
||||
github.com/valyala/fastjson
|
||||
github.com/valyala/fastjson/fastfloat
|
||||
# github.com/valyala/fastrand v1.0.0
|
||||
|
|
Loading…
Reference in a new issue