1 // Copyright 2021 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 func FuzzUnmarshalJSON(f
*testing
.F
) {
30 f
.Fuzz(func(t
*testing
.T
, b
[]byte) {
31 for _
, typ
:= range []func() interface{}{
32 func() interface{} { return new(interface{}) },
33 func() interface{} { return new(map[string]interface{}) },
34 func() interface{} { return new([]interface{}) },
37 if err
:= Unmarshal(b
, i
); err
!= nil {
41 encoded
, err
:= Marshal(i
)
43 t
.Fatalf("failed to marshal: %s", err
)
46 if err
:= Unmarshal(encoded
, i
); err
!= nil {
47 t
.Fatalf("failed to roundtrip: %s", err
)
53 func FuzzDecoderToken(f
*testing
.F
) {
70 f
.Fuzz(func(t
*testing
.T
, b
[]byte) {
71 r
:= bytes
.NewReader(b
)