Skip to content

Commit b935f7b

Browse files
yincongcyinconggopherbot
authored andcommitted
html: avoid endless loop on error token
Fixes #70179 Change-Id: I2a0a1fc2e96f7d8eefd0abdf7ef8ba243a6e8645 GitHub-Last-Rev: a601ecd GitHub-Pull-Request: #226 Reviewed-on: https://go-review.googlesource.com/c/net/+/624895 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent 9af49ef commit b935f7b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

html/parse.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,10 @@ func afterHeadIM(p *parser) bool {
840840

841841
p.parseImpliedToken(StartTagToken, a.Body, a.Body.String())
842842
p.framesetOK = true
843+
if p.tok.Type == ErrorToken {
844+
// Stop parsing.
845+
return true
846+
}
843847
return false
844848
}
845849

html/parse_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ func TestParseFragmentForeignContentTemplates(t *testing.T) {
468468
srcs := []string{
469469
"<math><html><template><mn><template></template></template>",
470470
"<math><math><head><mi><template>",
471+
"<svg><head><title><select><input>",
471472
}
472473
for _, src := range srcs {
473474
// The next line shouldn't infinite-loop.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy