internal/encoding/json: fix crash in parsing
Fuzzer-detected crash when parsing: {""
Change-Id: I019c667f48e6a1237858b5abf7d34f43593fb3b6
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/212357
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/encoding/json/decode_test.go b/internal/encoding/json/decode_test.go
index c29d508..c896a2e 100644
--- a/internal/encoding/json/decode_test.go
+++ b/internal/encoding/json/decode_test.go
@@ -873,6 +873,13 @@
},
},
{
+ input: `{""`,
+ want: []R{
+ {T: json.StartObject},
+ {E: `syntax error (line 1:4): unexpected EOF`},
+ },
+ },
+ {
input: `{"34":"89",}`,
want: []R{
{T: json.StartObject},