This commit is contained in:
Vadim A. Misbakh-Soloviov 2021-08-25 11:45:20 +07:00
parent 4f6437ebd1
commit b8e676b6a6
No known key found for this signature in database
GPG Key ID: 6765F46F28E9607E

View File

@ -168,6 +168,7 @@ local function parse(text,limit) -- {{{
local tagst, apos = tag:gettext(), 1 local tagst, apos = tag:gettext(), 1
-- }}} -- }}}
while true do -- TagLoop {{{ while true do -- TagLoop {{{
dbg("[TagLoop]:#LINE# tag.name=%s, tagloop=%s",str(tag.name),str(tagloop))
if tagloop == limit then -- {{{ if tagloop == limit then -- {{{
err("Tag parsing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit) err("Tag parsing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit)
break break
@ -212,6 +213,7 @@ local function parse(text,limit) -- {{{
descend = false descend = false
tag:close() tag:close()
else else
descend = true
opentags[tag.name] = opentags[tag.name] or {} opentags[tag.name] = opentags[tag.name] or {}
table.insert(opentags[tag.name], tag) table.insert(opentags[tag.name], tag)
end end
@ -219,6 +221,7 @@ local function parse(text,limit) -- {{{
local closeend = tpos local closeend = tpos
local closingloop local closingloop
while true do -- TagCloseLoop {{{ while true do -- TagCloseLoop {{{
if voidelements[tag.name:lower()] then break end -- already closed
if closingloop == limit then if closingloop == limit then
err("Tag closing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit) err("Tag closing loop reached loop limit (%d). Consider either increasing it or checking HTML-code for syntax errors", limit)
break break