]> Cypherpunks repositories - gostls13.git/commit
encoding/json: Only allow string option for valid types
authorLarz Conwell <larzconwell@gmail.com>
Sun, 17 May 2015 03:01:39 +0000 (23:01 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 15 Jul 2015 01:35:56 +0000 (01:35 +0000)
commit1a4e1770f6869a14c93c8e20a2671a2f32351621
tree00a057021826b5bf098a99cf86a8cc90ff2ca4b6
parente66d04ea59117e4b981d905ccb453b38589a2c51
encoding/json: Only allow string option for valid types

The "string" option only applies for strings, floats, integers, and
booleans as per the documentation. So when decoding ignore the "string"
option if the value is not of one of the types mentioned. This matches
the Marshal step which also ignores the "string" option for invalid
types.

Fixes #9812

Change-Id: I0fb2b43d0668bc0e2985886d989abbf2252070e2
Reviewed-on: https://go-review.googlesource.com/10183
Reviewed-by: Russ Cox <rsc@golang.org>
src/encoding/json/decode_test.go
src/encoding/json/encode.go