mirror of
https://github.com/golang/net.git
synced 2026-03-31 18:37:08 +09:00
html: fix tokenizer error
Trailing '<' entities in the text token make the tokenizer fail
for escapable raw text elements like title and textarea
Fixes golang/go#34281
Change-Id: I6fe8f2229b5fd639cf5a02ab1db31f18ea034c8b
GitHub-Last-Rev: 4a9da03177
GitHub-Pull-Request: golang/net#53
Reviewed-on: https://go-review.googlesource.com/c/net/+/196620
Run-TryBot: Kunpei Sakai <kunpei@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This commit is contained in:
@@ -347,6 +347,7 @@ loop:
|
||||
break loop
|
||||
}
|
||||
if c != '/' {
|
||||
z.raw.end--
|
||||
continue loop
|
||||
}
|
||||
if z.readRawEndTag() || z.err != nil {
|
||||
|
||||
@@ -258,6 +258,11 @@ var tokenTests = []tokenTest{
|
||||
"<title><b>K&R C</b></title>",
|
||||
"<title>$<b>K&R C</b>$</title>",
|
||||
},
|
||||
{
|
||||
"title with trailing '<' entity",
|
||||
"<title>foobar<</title>",
|
||||
"<title>$foobar<$</title>",
|
||||
},
|
||||
// DOCTYPE tests.
|
||||
{
|
||||
"Proper DOCTYPE",
|
||||
|
||||
Reference in New Issue
Block a user