You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package foobar
import "testing"
import "strings"
import "github.com/goccy/go-json"
func Fuzz_JSON_Unmarshal(f *testing.F) {
f.Add([]byte(`{}`))
f.Add([]byte(`{"n": 123}`))
f.Add([]byte(`{"n": -123}`))
f.Fuzz(func(t *testing.T, input []byte) {
var x struct {
N int32 `json:"n"`
}
err := json.Unmarshal(input, &x)
if err == nil {
return
}
// I was actually looking for a specific error message and just stumbled upon
// the panic.
if strings.Contains(err.Error(), "number u") {
t.Error("found it")
}
})
}
There are two closed issues with similar panics, one of them while decoding unicode but in a slightly different code path.
The text was updated successfully, but these errors were encountered:
orisano
added a commit
to orisano/go-json
that referenced
this issue
Feb 22, 2023
Hi,
I'm getting the following panic when decoding
{"\u
which is invalid but shouldn't cause a panic:This is the fuzz test I used:
There are two closed issues with similar panics, one of them while decoding unicode but in a slightly different code path.
The text was updated successfully, but these errors were encountered: