[php-src] PR #14089: Fix crashes when entity declaration is removed while still having entity references
| From: | nielsdos | Date: | Tue, 30 Apr 2024 18:33:47 +0000 |
| Subject: | [php-src] PR #14089: Fix crashes when entity declaration is removed while still having entity references | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25947@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14089
Author: nielsdos
libxml doesn't do reference counting inside its node types. It's possible to remove an
entity declaration out of the document, but then entity references will keep pointing to that stale
declaration. This will cause crashes.
One idea would be to check when a declaration is removed, to trigger a hook that updates all
references. However this means we have to keep track of all references somehow, which would be a
high-overhead solution. The solution in this patch makes sure that the fields are always updated
before they are read.