mirror of
https://github.com/golang/net.git
synced 2026-03-31 18:37:08 +09:00
html: Add missing condition to 'in cell' insertion mode, required by spec
In section 12.2.6.4.15 of the spec, there is a condition that the current node is a td or th element, which is not implemented. This can lead to a panic when the open elements stack is popped whilst empty, as outlined in golang/go#30600. This commit implements that check.
Fixes golang/go#30600
Change-Id: I4837815e2edce21b58a985a100d93d146bf71e24
GitHub-Last-Rev: 79084c5a84
GitHub-Pull-Request: golang/net#41
Reviewed-on: https://go-review.googlesource.com/c/net/+/172377
Reviewed-by: Kunpei Sakai <namusyaka@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
@@ -1744,8 +1744,9 @@ func inCellIM(p *parser) bool {
|
||||
return true
|
||||
}
|
||||
// Close the cell and reprocess.
|
||||
p.popUntil(tableScope, a.Td, a.Th)
|
||||
p.clearActiveFormattingElements()
|
||||
if p.popUntil(tableScope, a.Td, a.Th) {
|
||||
p.clearActiveFormattingElements()
|
||||
}
|
||||
p.im = inRowIM
|
||||
return false
|
||||
}
|
||||
|
||||
12
html/testdata/go/issue_30600_parse_panics_in_cell_mode.dat
vendored
Normal file
12
html/testdata/go/issue_30600_parse_panics_in_cell_mode.dat
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#data
|
||||
<table><math><th><mo><select></table>
|
||||
#errors
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <math math>
|
||||
| <math th>
|
||||
| <math mo>
|
||||
| <select>
|
||||
| <table>
|
||||
11
html/testdata/go/issue_30961_error_nested_unknown_tag_types.dat
vendored
Normal file
11
html/testdata/go/issue_30961_error_nested_unknown_tag_types.dat
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#data
|
||||
<html><head></head><body><tag1><tag2 /><p></p></tag1><div></div></body></html>
|
||||
#errors
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <tag1>
|
||||
| <tag2>
|
||||
| <p>
|
||||
| <div>
|
||||
12
html/testdata/go/template.dat
vendored
12
html/testdata/go/template.dat
vendored
@@ -60,15 +60,3 @@
|
||||
| <math template>
|
||||
| <math mn>
|
||||
| <b>
|
||||
|
||||
#data
|
||||
<html><head></head><body><tag1><tag2 /><p></p></tag1><div></div></body></html>
|
||||
#errors
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <tag1>
|
||||
| <tag2>
|
||||
| <p>
|
||||
| <div>
|
||||
|
||||
Reference in New Issue
Block a user