aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/decode.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/decode.go')
-rw-r--r--src/encoding/json/decode.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go
index 6fa2ea4e0c..5f34af44ea 100644
--- a/src/encoding/json/decode.go
+++ b/src/encoding/json/decode.go
@@ -1221,6 +1221,11 @@ func (d *decodeState) unquoteBytes(s []byte) (t []byte, ok bool) {
if r == -1 {
return s, true
}
+ // Only perform up to one safe unquote for each re-scanned string
+ // literal. In some edge cases, the decoder unquotes a literal a second
+ // time, even after another literal has been re-scanned. Thus, only the
+ // first unquote can safely use safeUnquote.
+ d.safeUnquote = 0
b := make([]byte, len(s)+2*utf8.UTFMax)
w := copy(b, s[0:r])