]> Cypherpunks repositories - gostls13.git/commitdiff
json: accept escaped slash in string scanner
authorMichael Hoisie <hoisie@gmail.com>
Sun, 9 May 2010 00:34:05 +0000 (17:34 -0700)
committerRuss Cox <rsc@golang.org>
Sun, 9 May 2010 00:34:05 +0000 (17:34 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/1173041

src/pkg/json/decode_test.go
src/pkg/json/scanner.go

index 9e7d810cee7d7d19ea1e8d74f5bffce9d2046fb7..edbd9c88622837ccd72fcea3525dc05b5e1c66ef 100644 (file)
@@ -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},
index c1934c8d99e162af71d6f37ea405777f99286fd4..27c5ffb7a4da2a49631e4be6c72dd72cfcd6f8c0 100644 (file)
@@ -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
        }