]> Cypherpunks repositories - gostls13.git/commit
encoding/json: always ignore embedded pointers to unexported struct types
authorJoe Tsai <joetsai@digital-static.net>
Fri, 10 Nov 2017 04:14:47 +0000 (20:14 -0800)
committerJoe Tsai <thebrokentoaster@gmail.com>
Mon, 13 Nov 2017 18:23:38 +0000 (18:23 +0000)
commit0cee4b7b780053425a24219866b894a46b1cfd5f
tree0beedb58dee58c15e132f471f16d29a9cbef3950
parent510327012bd42aca3deac989e2e109dc71bb4605
encoding/json: always ignore embedded pointers to unexported struct types

CL 60410 fixes a bug in reflect that allows assignments to an embedded
field of a pointer to an unexported struct type.
This breaks the json package because unmarshal is now unable to assign
a newly allocated struct to such fields.

In order to be consistent in the behavior for marshal and unmarshal,
this CL changes both marshal and unmarshal to always ignore
embedded pointers to unexported structs.

Fixes #21357

Change-Id: If62ea11155555e61115ebb9cfa5305caf101bde5
Reviewed-on: https://go-review.googlesource.com/76851
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/encoding/json/decode_test.go
src/encoding/json/encode.go
src/encoding/json/encode_test.go