Hash :
93ce33c2
Author :
Date :
2020-07-23T17:34:08
Fix several quadratic runtime issues in HTML push parser Fix a few remaining cases where the HTML push parser would scan more content during lookahead than being parsed later. Make sure that htmlParseDocTypeDecl consumes all content up to the final '>' in case of errors. The old comment said "We shouldn't try to resynchronize", but ignoring invalid content is also what the HTML5 spec mandates. Likewise, make htmlParseEndTag skip to the final '>' in invalid end tags even if not in recovery mode. This is probably the most visible change in practice and leads to different output for some tests but is also more in line with HTML5. Make sure that htmlParsePI and htmlParseComment don't abort if invalid characters are encountered but log an error and ignore the character. Change some other end-of-buffer checks to test for a zero byte instead of relying on IS_CHAR. Fix usage of IS_CHAR macro in htmlParseScript.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
./test/HTML/wired.html:6: HTML parser error : htmlParseEntityRef: expecting ';'
<FORM METHOD=GET ACTION="http://nsads.hotwired.com/event.ng/Type=click&ProfileID
^
./test/HTML/wired.html:6: HTML parser error : htmlParseEntityRef: expecting ';'
D=GET ACTION="http://nsads.hotwired.com/event.ng/Type=click&ProfileID=9688&RunID
^
./test/HTML/wired.html:6: HTML parser error : htmlParseEntityRef: expecting ';'
N="http://nsads.hotwired.com/event.ng/Type=click&ProfileID=9688&RunID=14074&AdID
^
./test/HTML/wired.html:6: HTML parser error : htmlParseEntityRef: expecting ';'
s.hotwired.com/event.ng/Type=click&ProfileID=9688&RunID=14074&AdID=22584&GroupID
^
./test/HTML/wired.html:6: HTML parser error : htmlParseEntityRef: expecting ';'
com/event.ng/Type=click&ProfileID=9688&RunID=14074&AdID=22584&GroupID=1&FamilyID
^
./test/HTML/wired.html:6: HTML parser error : htmlParseEntityRef: expecting ';'
pe=click&ProfileID=9688&RunID=14074&AdID=22584&GroupID=1&FamilyID=2684&TagValues
^
./test/HTML/wired.html:52: HTML parser error : htmlParseEntityRef: expecting ';'
" align="RIGHT"><a href="http://nsads.hotwired.com/event.ng/Type=click&ProfileID
^
./test/HTML/wired.html:52: HTML parser error : htmlParseEntityRef: expecting ';'
GHT"><a href="http://nsads.hotwired.com/event.ng/Type=click&ProfileID=5597&RunID
^
./test/HTML/wired.html:52: HTML parser error : htmlParseEntityRef: expecting ';'
f="http://nsads.hotwired.com/event.ng/Type=click&ProfileID=5597&RunID=17167&AdID
^
./test/HTML/wired.html:52: HTML parser error : htmlParseEntityRef: expecting ';'
s.hotwired.com/event.ng/Type=click&ProfileID=5597&RunID=17167&AdID=22588&GroupID
^
./test/HTML/wired.html:52: HTML parser error : htmlParseEntityRef: expecting ';'
com/event.ng/Type=click&ProfileID=5597&RunID=17167&AdID=22588&GroupID=1&FamilyID
^
./test/HTML/wired.html:52: HTML parser error : htmlParseEntityRef: expecting ';'
pe=click&ProfileID=5597&RunID=17167&AdID=22588&GroupID=1&FamilyID=3228&TagValues
^
./test/HTML/wired.html:70: HTML parser error : Tag nobr invalid
<td bgcolor="#FF0000" align="left" valign="center"><nobr><img src="http://static
^
./test/HTML/wired.html:89: HTML parser error : htmlParseEntityRef: expecting ';'
on value="http://search.hotwired.com/search97/s97.vts?Action=FilterSearch&Filter
^
./test/HTML/wired.html:89: HTML parser error : htmlParseEntityRef: expecting ';'
d.com/search97/s97.vts?Action=FilterSearch&Filter=docs_filter.hts&ResultTemplate
^
./test/HTML/wired.html:89: HTML parser error : htmlParseEntityRef: expecting ';'
ction=FilterSearch&Filter=docs_filter.hts&ResultTemplate=vignette.hts&Collection
^
./test/HTML/wired.html:89: HTML parser error : htmlParseEntityRef: expecting ';'
Filter=docs_filter.hts&ResultTemplate=vignette.hts&Collection=vignette&QueryMode
^
./test/HTML/wired.html:89: HTML parser error : htmlParseEntityRef: expecting ';'
ter.hts&ResultTemplate=vignette.hts&Collection=vignette&QueryMode=Internet&Query
^
./test/HTML/wired.html:90: HTML parser error : htmlParseEntityRef: expecting ';'
on value="http://search.hotwired.com/search97/s97.vts?Action=FilterSearch&Filter
^
./test/HTML/wired.html:90: HTML parser error : htmlParseEntityRef: expecting ';'
d.com/search97/s97.vts?Action=FilterSearch&Filter=docs_filter.hts&ResultTemplate
^
./test/HTML/wired.html:90: HTML parser error : htmlParseEntityRef: expecting ';'
tion=FilterSearch&Filter=docs_filter.hts&ResultTemplate=webmonkey.hts&Collection
^
./test/HTML/wired.html:90: HTML parser error : htmlParseEntityRef: expecting ';'
lter=docs_filter.hts&ResultTemplate=webmonkey.hts&Collection=webmonkey&QueryMode
^
./test/HTML/wired.html:90: HTML parser error : htmlParseEntityRef: expecting ';'
r.hts&ResultTemplate=webmonkey.hts&Collection=webmonkey&QueryMode=Internet&Query
^
./test/HTML/wired.html:91: HTML parser error : htmlParseEntityRef: expecting ';'
="http://search.hotwired.com/search97/s97.vts?collection=webmonkey_guides&Action
^
./test/HTML/wired.html:91: HTML parser error : htmlParseEntityRef: expecting ';'
ired.com/search97/s97.vts?collection=webmonkey_guides&Action=FilterSearch&filter
^
./test/HTML/wired.html:91: HTML parser error : htmlParseEntityRef: expecting ';'
ction=webmonkey_guides&Action=FilterSearch&filter=docs_filter.hts&ResultTemplate
^
./test/HTML/wired.html:91: HTML parser error : htmlParseEntityRef: expecting ';'
ilterSearch&filter=docs_filter.hts&ResultTemplate=webmonkey_guides.hts&QueryMode
^
./test/HTML/wired.html:91: HTML parser error : htmlParseEntityRef: expecting ';'
ter=docs_filter.hts&ResultTemplate=webmonkey_guides.hts&QueryMode=Internet&Query
^
./test/HTML/wired.html:92: HTML parser error : htmlParseEntityRef: expecting ';'
on value="http://search.hotwired.com/search97/s97.vts?collection=hotwired&Action
^
./test/HTML/wired.html:92: HTML parser error : htmlParseEntityRef: expecting ';'
rch.hotwired.com/search97/s97.vts?collection=hotwired&Action=FilterSearch&filter
^
./test/HTML/wired.html:92: HTML parser error : htmlParseEntityRef: expecting ';'
ts?collection=hotwired&Action=FilterSearch&filter=docs_filter.hts&ResultTemplate
^
./test/HTML/wired.html:92: HTML parser error : htmlParseEntityRef: expecting ';'
ilterSearch&filter=docs_filter.hts&ResultTemplate=hotwired_archive.hts&QueryMode
^
./test/HTML/wired.html:92: HTML parser error : htmlParseEntityRef: expecting ';'
ter=docs_filter.hts&ResultTemplate=hotwired_archive.hts&QueryMode=Internet&Query
^
./test/HTML/wired.html:93: HTML parser error : htmlParseEntityRef: expecting ';'
on value="http://search.hotwired.com/search97/s97.vts?Action=FilterSearch&Filter
^
./test/HTML/wired.html:93: HTML parser error : htmlParseEntityRef: expecting ';'
d.com/search97/s97.vts?Action=FilterSearch&Filter=docs_filter.hts&ResultTemplate
^
./test/HTML/wired.html:93: HTML parser error : htmlParseEntityRef: expecting ';'
ction=FilterSearch&Filter=docs_filter.hts&ResultTemplate=magazine.hts&Collection
^
./test/HTML/wired.html:93: HTML parser error : htmlParseEntityRef: expecting ';'
Filter=docs_filter.hts&ResultTemplate=magazine.hts&Collection=magazine&QueryMode
^
./test/HTML/wired.html:93: HTML parser error : htmlParseEntityRef: expecting ';'
ter.hts&ResultTemplate=magazine.hts&Collection=magazine&QueryMode=Internet&Query
^
./test/HTML/wired.html:94: HTML parser error : htmlParseEntityRef: expecting ';'
on value="http://search.hotwired.com/search97/s97.vts?Action=FilterSearch&Filter
^
./test/HTML/wired.html:94: HTML parser error : htmlParseEntityRef: expecting ';'
d.com/search97/s97.vts?Action=FilterSearch&Filter=docs_filter.hts&ResultTemplate
^
./test/HTML/wired.html:94: HTML parser error : htmlParseEntityRef: expecting ';'
tion=FilterSearch&Filter=docs_filter.hts&ResultTemplate=animation.hts&Collection
^
./test/HTML/wired.html:94: HTML parser error : htmlParseEntityRef: expecting ';'
lter=docs_filter.hts&ResultTemplate=animation.hts&Collection=animation&QueryMode
^
./test/HTML/wired.html:94: HTML parser error : htmlParseEntityRef: expecting ';'
r.hts&ResultTemplate=animation.hts&Collection=animation&QueryMode=Internet&Query
^
./test/HTML/wired.html:95: HTML parser error : htmlParseEntityRef: expecting ';'
option value="http://search.hotwired.com/search97/s97.vts?collection=suck&Action
^
./test/HTML/wired.html:95: HTML parser error : htmlParseEntityRef: expecting ';'
/search.hotwired.com/search97/s97.vts?collection=suck&Action=FilterSearch&filter
^
./test/HTML/wired.html:95: HTML parser error : htmlParseEntityRef: expecting ';'
97.vts?collection=suck&Action=FilterSearch&filter=docs_filter.hts&ResultTemplate
^
./test/HTML/wired.html:95: HTML parser error : htmlParseEntityRef: expecting ';'
uck&Action=FilterSearch&filter=docs_filter.hts&ResultTemplate=suck.hts&QueryMode
^
./test/HTML/wired.html:95: HTML parser error : htmlParseEntityRef: expecting ';'
erSearch&filter=docs_filter.hts&ResultTemplate=suck.hts&QueryMode=Internet&Query
^
./test/HTML/wired.html:96: HTML parser error : htmlParseEntityRef: expecting ';'
lue="http://search.hotwired.com/search97/s97.vts?collection=uber_hotwired&Action
^
./test/HTML/wired.html:96: HTML parser error : htmlParseEntityRef: expecting ';'
otwired.com/search97/s97.vts?collection=uber_hotwired&Action=FilterSearch&filter
^
./test/HTML/wired.html:96: HTML parser error : htmlParseEntityRef: expecting ';'
llection=uber_hotwired&Action=FilterSearch&filter=docs_filter.hts&ResultTemplate
^
./test/HTML/wired.html:96: HTML parser error : htmlParseEntityRef: expecting ';'
n=FilterSearch&filter=docs_filter.hts&ResultTemplate=uber_hotwired.hts&QueryMode
^
./test/HTML/wired.html:96: HTML parser error : htmlParseEntityRef: expecting ';'
filter=docs_filter.hts&ResultTemplate=uber_hotwired.hts&QueryMode=Internet&Query
^
./test/HTML/wired.html:97: HTML parser error : htmlParseEntityRef: expecting ';'
<option value="http://www.hotbot.com/?SM=MC&DV=0&LG=any&RD=RG&DC=10&DE=2&_v=2&O
^
./test/HTML/wired.html:97: HTML parser error : htmlParseEntityRef: expecting ';'
<option value="http://www.hotbot.com/?SM=MC&DV=0&LG=any&RD=RG&DC=10&DE=2&_v=2&O
^
./test/HTML/wired.html:97: HTML parser error : htmlParseEntityRef: expecting ';'
<option value="http://www.hotbot.com/?SM=MC&DV=0&LG=any&RD=RG&DC=10&DE=2&_v=2&O
^
./test/HTML/wired.html:97: HTML parser error : htmlParseEntityRef: expecting ';'
<option value="http://www.hotbot.com/?SM=MC&DV=0&LG=any&RD=RG&DC=10&DE=2&_v=2&O
^
./test/HTML/wired.html:97: HTML parser error : htmlParseEntityRef: expecting ';'
<option value="http://www.hotbot.com/?SM=MC&DV=0&LG=any&RD=RG&DC=10&DE=2&_v=2&O
^
./test/HTML/wired.html:97: HTML parser error : htmlParseEntityRef: expecting ';'
<option value="http://www.hotbot.com/?SM=MC&DV=0&LG=any&RD=RG&DC=10&DE=2&_v=2&O
^
./test/HTML/wired.html:97: HTML parser error : htmlParseEntityRef: expecting ';'
option value="http://www.hotbot.com/?SM=MC&DV=0&LG=any&RD=RG&DC=10&DE=2&_v=2&OPs
^
./test/HTML/wired.html:97: HTML parser error : htmlParseEntityRef: expecting ';'
lue="http://www.hotbot.com/?SM=MC&DV=0&LG=any&RD=RG&DC=10&DE=2&_v=2&OPs=MDRTP&MT
^
./test/HTML/wired.html:170: HTML parser error : Unexpected end tag : form
</tr> </form>
^
./test/HTML/wired.html:248: HTML parser error : htmlParseEntityRef: expecting ';'
MG SRC="http://barnesandnoble.bfast.com/booklink/serve?sourceid=383471&is_search
^
./test/HTML/wired.html:265: HTML parser error : Unexpected end tag : form
</tr> </form>
^
./test/HTML/wired.html:346: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:374: HTML parser error : htmlParseEntityRef: no name
a, sans-serif"><b><a href="/news/commentarySection/0,1292,31926,00.html">Rants &
^
./test/HTML/wired.html:374: HTML parser error : Opening and ending tag mismatch: td and font
Readers on Apple's G4 ... AOL's passwords ... MS vs. Linux.</font><br><br> </td
^
./test/HTML/wired.html:374: HTML parser error : Opening and ending tag mismatch: td and font
Readers on Apple's G4 ... AOL's passwords ... MS vs. Linux.</font><br><br> </td
^
./test/HTML/wired.html:402: HTML parser error : Opening and ending tag mismatch: a and font
w.vignette.com/" style="text-decoration:none"><font color="#000000">Vignette</a>
^
./test/HTML/wired.html:407: HTML parser error : htmlParseEntityRef: expecting ';'
ervlet/appservlet?from=/wired/sprint/&template=/security/security.html&SITE=
^
./test/HTML/wired.html:407: HTML parser error : htmlParseEntityRef: expecting ';'
ervlet/appservlet?from=/wired/sprint/&template=/security/security.html&SITE=
^
./test/HTML/wired.html:408: HTML parser error : htmlParseEntityRef: expecting ';'
wired.com&BANNER=Sprint" style="text-decoration:none"><font color="#000000">Spri
^
./test/HTML/wired.html:408: HTML parser error : Opening and ending tag mismatch: a and font
com&BANNER=Sprint" style="text-decoration:none"><font color="#000000">Sprint</a>
^
./test/HTML/wired.html:408: HTML parser error : End tag : expected '>'
=Sprint" style="text-decoration:none"><font color="#000000">Sprint</a></i></font
^
./test/HTML/wired.html:414: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:414: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:414: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:414: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:414: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:414: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:414: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:414: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:414: HTML parser error : Opening and ending tag mismatch: td and font
</td>
^
./test/HTML/wired.html:432: HTML parser error : htmlParseEntityRef: expecting ';'
href="http://www.lycos.com/news/flash/hitlerbunker.html?v=wn1015&lpv=1">Lycos</a
^