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
da62e894dd
commit
7edbd930d5
8 changed files with 58 additions and 7 deletions
2
go.mod
2
go.mod
|
@ -12,7 +12,7 @@ require (
|
||||||
github.com/jstemmer/go-junit-report v0.9.1 // indirect
|
github.com/jstemmer/go-junit-report v0.9.1 // indirect
|
||||||
github.com/klauspost/compress v1.9.4
|
github.com/klauspost/compress v1.9.4
|
||||||
github.com/lithammer/go-jump-consistent-hash v1.0.1
|
github.com/lithammer/go-jump-consistent-hash v1.0.1
|
||||||
github.com/valyala/fastjson v1.4.1
|
github.com/valyala/fastjson v1.4.2
|
||||||
github.com/valyala/fastrand v1.0.0
|
github.com/valyala/fastrand v1.0.0
|
||||||
github.com/valyala/gozstd v1.6.4
|
github.com/valyala/gozstd v1.6.4
|
||||||
github.com/valyala/histogram v1.0.1
|
github.com/valyala/histogram v1.0.1
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -99,8 +99,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 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
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/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.2 h1:vJXOwCenHuSyEfxWBUtzZl9LqyfgN2YkaNQBPHHEYbk=
|
||||||
github.com/valyala/fastjson v1.4.1/go.mod h1:nV6MsjxL2IMJQUoHDIrjEI7oLyeqK6aBD7EFWPsvP8o=
|
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 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI=
|
||||||
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
||||||
github.com/valyala/gozstd v1.6.4 h1:nFLddjEf90SFl5cVWyElSHozQDsbvLljPK703/skBS0=
|
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)
|
* 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.
|
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
|
## 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 (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
"strings"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -132,6 +133,15 @@ func ParseBestEffort(s string) float64 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if i <= j {
|
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
|
return 0
|
||||||
}
|
}
|
||||||
f := float64(d)
|
f := float64(d)
|
||||||
|
@ -229,3 +239,6 @@ func ParseBestEffort(s string) float64 {
|
||||||
}
|
}
|
||||||
return 0
|
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.
|
// 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.
|
// The function is slower than the Parser.ParseBytes for re-used Parser.
|
||||||
func MustParseBytes(b []byte) *Value {
|
func MustParseBytes(b []byte) *Value {
|
||||||
v, err := ParseBytes(b)
|
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 {
|
if o.keysUnescaped {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for i := range o.kvs {
|
kvs := o.kvs
|
||||||
kv := &o.kvs[i]
|
for i := range kvs {
|
||||||
|
kv := &kvs[i]
|
||||||
kv.k = unescapeStringBestEffort(kv.k)
|
kv.k = unescapeStringBestEffort(kv.k)
|
||||||
}
|
}
|
||||||
o.keysUnescaped = true
|
o.keysUnescaped = true
|
||||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -92,7 +92,7 @@ github.com/klauspost/compress/zstd/internal/xxhash
|
||||||
github.com/lithammer/go-jump-consistent-hash
|
github.com/lithammer/go-jump-consistent-hash
|
||||||
# github.com/valyala/bytebufferpool v1.0.0
|
# github.com/valyala/bytebufferpool v1.0.0
|
||||||
github.com/valyala/bytebufferpool
|
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
|
||||||
github.com/valyala/fastjson/fastfloat
|
github.com/valyala/fastjson/fastfloat
|
||||||
# github.com/valyala/fastrand v1.0.0
|
# github.com/valyala/fastrand v1.0.0
|
||||||
|
|
Loading…
Reference in a new issue