Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove doctype node after node elements have been analyzed #52

Closed
ohader opened this issue Jul 15, 2021 · 0 comments
Closed

Remove doctype node after node elements have been analyzed #52

ohader opened this issue Jul 15, 2021 · 0 comments

Comments

@ohader
Copy link
Contributor

ohader commented Jul 15, 2021

This is really a strange scenario - however in the end it occasionally caused segmentation faults...

vendor/bin/phpunit --no-coverage --filter=/doctypeAndEntityAreRemoved/
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

[1]    63007 segmentation fault  vendor/bin/phpunit --no-coverage --filter=/doctypeAndEntityAreRemoved/

PR #53 adds corresponding entityTest.svg (used in test-case doctypeAndEntityAreRemoved) which defined a XML entity using <!DOCTYPE fortiguard [ <!ENTITY lab "cool, text as an image">]>.

It turned out that the sequence of removing doctype, followed by \DOMXPath on the document causes a segmentation fault (at least on PHP 7.2 and 7.4, using libxml2 2.9.10 (always) and 2.9.12 (occasionally)). This is the call stack:

ohader added a commit to ohader/svg-sanitizer that referenced this issue Jul 15, 2021
ohader added a commit to ohader/svg-sanitizer that referenced this issue Jul 15, 2021
@ohader ohader changed the title Segmentation Fault when processing XML entities Remove doctype node after node elements have been analyzed Jul 15, 2021
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

No branches or pull requests

2 participants