mirror of
https://github.com/golang/go
synced 2024-11-22 01:34:41 -07:00
xml: Allow entities inside CDATA tags
Fixes #1112. R=rsc CC=golang-dev https://golang.org/cl/2255042
This commit is contained in:
parent
2ee420fa5e
commit
8d87ccad0b
@ -790,7 +790,7 @@ Input:
|
|||||||
if quote >= 0 && b == byte(quote) {
|
if quote >= 0 && b == byte(quote) {
|
||||||
break Input
|
break Input
|
||||||
}
|
}
|
||||||
if b == '&' {
|
if b == '&' && !cdata {
|
||||||
// Read escaped character expression up to semicolon.
|
// Read escaped character expression up to semicolon.
|
||||||
// XML in all its glory allows a document to define and use
|
// XML in all its glory allows a document to define and use
|
||||||
// its own character names with <!ENTITY ...> directives.
|
// its own character names with <!ENTITY ...> directives.
|
||||||
|
@ -387,3 +387,14 @@ func TestTrailingToken(t *testing.T) {
|
|||||||
t.Fatalf("p.Token() = _, %v, want _, os.EOF", err)
|
t.Fatalf("p.Token() = _, %v, want _, os.EOF", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEntityInsideCDATA(t *testing.T) {
|
||||||
|
input := `<test><![CDATA[ &val=foo ]]></test>`
|
||||||
|
p := NewParser(StringReader(input))
|
||||||
|
var err os.Error
|
||||||
|
for _, err = p.Token(); err == nil; _, err = p.Token() {
|
||||||
|
}
|
||||||
|
if err != os.EOF {
|
||||||
|
t.Fatalf("p.Token() = _, %v, want _, os.EOF", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user