Issue #6662: Fix parsing of malformatted charref (&#bad;)

This commit is contained in:
Victor Stinner 2010-05-24 21:33:24 +00:00
parent f0757a2937
commit 554a3b82e4
3 changed files with 12 additions and 0 deletions

View file

@ -175,6 +175,9 @@ class HTMLParser(markupbase.ParserBase):
i = self.updatepos(i, k)
continue
else:
if ";" in rawdata[i:]: #bail by consuming &#
self.handle_data(rawdata[0:2])
i = self.updatepos(i, 2)
break
elif startswith('&', i):
match = entityref.match(rawdata, i)