8000 html: avoid endless loop on error token by yincongcyincong · Pull Request #226 · golang/net · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

html: avoid endless loop on error token #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions html/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,10 @@ func afterHeadIM(p *parser) bool {

p.parseImpliedToken(StartTagToken, a.Body, a.Body.String())
p.framesetOK = true
if p.tok.Type == ErrorToken {
// Stop parsing.
return true
}
return false
}

Expand Down
1 change: 1 addition & 0 deletions html/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ func TestParseFragmentForeignContentTemplates(t *testing.T) {
srcs := []string{
"<math><html><template><mn><template></template></template>",
"<math><math><head><mi><template>",
"<svg><head><title><select><input>",
}
for _, src := range srcs {
// The next line shouldn't infinite-loop.
Expand Down
0