Skip to content

Prevent crash when the mark stack runs empty in DOMSerializer - #98

Open
artif-AndreasBrus wants to merge 1 commit into
ueberdosis:mainfrom
artif-AndreasBrus:fix/domserializer-empty-mark-stack
Open

artif-AndreasBrus wants to merge 1 commit into
ueberdosis:mainfrom
artif-AndreasBrus:fix/domserializer-empty-mark-stack

Conversation

@artif-AndreasBrus

Copy link
Copy Markdown

closeMarkTags() pops the mark stack once per tag it has to close, but the stack can run empty before every tag is closed when marks are nested inconsistently -- e.g. a mark duplicated on a node that already inherits the same mark from a sibling. array_pop() then returns null and renderHTML() is called on null, raising a fatal error.

Stop closing tags once the stack is empty instead. Adds a regression test covering a duplicated mark inherited from a sibling.

closeMarkTags() pops the mark stack once per tag it has to close, but the
stack can run empty before every tag is closed when marks are nested
inconsistently -- e.g. a mark duplicated on a node that already inherits
the same mark from a sibling. array_pop() then returns null and
renderHTML() is called on null, raising a fatal error.

Stop closing tags once the stack is empty instead. Adds a regression test
covering a duplicated mark inherited from a sibling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant