diff options
author | Michael Hoisie <hoisie@gmail.com> | 2010-05-08 17:34:05 -0700 |
---|---|---|
committer | Michael Hoisie <hoisie@gmail.com> | 2010-05-08 17:34:05 -0700 |
commit | 65d780d20a1c45f23e73f89e94fe601c8eea54b1 (patch) | |
tree | 272ea2247042b5ac0e94cbc8f2183179ad13a04c /src | |
parent | 6eadf96ce8f9000974ba5786dc7bede1782e839c (diff) | |
download | golang-65d780d20a1c45f23e73f89e94fe601c8eea54b1.tar.gz |
json: accept escaped slash in string scanner
R=rsc
CC=golang-dev
http://codereview.appspot.com/1173041
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pkg/json/decode_test.go | 1 | ||||
-rw-r--r-- | src/pkg/json/scanner.go | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/pkg/json/decode_test.go b/src/pkg/json/decode_test.go index 9e7d810ce..edbd9c886 100644 --- a/src/pkg/json/decode_test.go +++ b/src/pkg/json/decode_test.go @@ -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}, diff --git a/src/pkg/json/scanner.go b/src/pkg/json/scanner.go index c1934c8d9..27c5ffb7a 100644 --- a/src/pkg/json/scanner.go +++ b/src/pkg/json/scanner.go @@ -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 } |