Commit 834abb80 authored by Michael Hoisie's avatar Michael Hoisie Committed by Russ Cox

json: accept escaped slash in string scanner

R=rsc
CC=golang-dev
https://golang.org/cl/1173041
parent 52cc0581
......@@ -24,6 +24,7 @@ var unmarshalTests = []unmarshalTest{
unmarshalTest{`1.2`, new(float), 1.2},
unmarshalTest{`-5`, new(int16), int16(-5)},
unmarshalTest{`"a\u1234"`, new(string), "a\u1234"},
unmarshalTest{`"http:\/\/"`, new(string), "http://"},
unmarshalTest{`"g-clef: \uD834\uDD1E"`, new(string), "g-clef: \U0001D11E"},
unmarshalTest{`"invalid: \uD834x\uDD1E"`, new(string), "invalid: \uFFFDx\uFFFD"},
unmarshalTest{"null", new(interface{}), nil},
......
......@@ -349,7 +349,7 @@ func stateInString(s *scanner, c int) int {
// stateInStringEsc is the state after reading `"\` during a quoted string.
func stateInStringEsc(s *scanner, c int) int {
switch c {
case 'b', 'f', 'n', 'r', 't', '\\', '"':
case 'b', 'f', 'n', 'r', 't', '\\', '/', '"':
s.step = stateInString
return scanContinue
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment