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 <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 9af49ef commit b935f7b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

html/parse.go

+4
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

+1
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)