VictoriaMetrics/vendor/github.com/valyala/fastjson/fuzz.go

23 lines
274 B
Go
Raw Normal View History

2020-11-02 20:01:42 +00:00
// +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
}