summaryrefslogtreecommitdiff
path: root/decode.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@datawire.io>2022-08-16 02:22:23 -0600
committerLuke Shumaker <lukeshu@datawire.io>2022-08-16 02:29:04 -0600
commit9f75bb80b99f94c5c87582acb99e57c232caf01d (patch)
tree5da3c0cd1e62a09c3d77cb38dec1a67b931fa1fa /decode.go
parent8c0513a04ff3870f57bde230507aaa8c6b7e6e86 (diff)
Run the fuzzer a bit
Diffstat (limited to 'decode.go')
-rw-r--r--decode.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/decode.go b/decode.go
index f630541..e42c115 100644
--- a/decode.go
+++ b/decode.go
@@ -252,6 +252,7 @@ var (
jsonUnmarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()
textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
boolType = reflect.TypeOf(true)
+ float64Type = reflect.TypeOf(float64(0))
)
var kind2bits = map[reflect.Kind]int{
@@ -687,7 +688,7 @@ func (dec *Decoder) decodeAny() any {
}
f64, err := num.Float64()
if err != nil {
- panic("should not happen")
+ dec.panicType("number "+buf.String(), float64Type, err)
}
return f64
case 't', 'f':