diff options
Diffstat (limited to 'src/encoding/json/decode_test.go')
| -rw-r--r-- | src/encoding/json/decode_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go index 8da74fa3d3..719a9fa290 100644 --- a/src/encoding/json/decode_test.go +++ b/src/encoding/json/decode_test.go @@ -2334,3 +2334,15 @@ func TestUnmarshalPanic(t *testing.T) { Unmarshal([]byte("{}"), &unmarshalPanic{}) t.Fatalf("Unmarshal should have panicked") } + +// The decoder used to hang if decoding into an interface pointing to its own address. +// See golang.org/issues/31740. +func TestUnmarshalRecursivePointer(t *testing.T) { + var v interface{} + v = &v + data := []byte(`{"a": "b"}`) + + if err := Unmarshal(data, v); err != nil { + t.Fatal(err) + } +} |
