Skip to content

Commit e3ef4a9

Browse files
committed
encoding/xml: reject processing instructions with reserved names
This is required by the spec. Fixes: #68499
1 parent 3fd729b commit e3ef4a9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/encoding/xml/xml.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,11 @@ func (d *Decoder) rawToken() (Token, error) {
610610
}
611611
return nil, d.err
612612
}
613+
if len(target) >= 3 && target[0:3] != xmlPrefix &&
614+
(target[0] | 0x20) == 'x' && (target[1] | 0x20) == 'm' && (target[2] | 0x20) == 'l' {
615+
d.err = d.syntaxError("Processing instruction name is reserved")
616+
return nil, d.err
617+
}
613618
d.space()
614619
d.buf.Reset()
615620
var b0 byte

0 commit comments

Comments
 (0)