1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 00:18:23 +02:00
Files
archived-php-src/ext
Niels Dossche 0675edb933 Sanitize libxml2 globals before parsing
Fixes GHSA-3qrf-m4j2-pcrr.

To parse a document with libxml2, you first need to create a parsing context.
The parsing context contains parsing options (e.g. XML_NOENT to substitute
entities) that the application (in this case PHP) can set.
Unfortunately, libxml2 also supports providing default set options.
For example, if you call xmlSubstituteEntitiesDefault(1) then the XML_NOENT
option will be added to the parsing options every time you create a parsing
context **even if the application never requested XML_NOENT**.

Third party extensions can override these globals, in particular the
substitute entity global. This causes entity substitution to be
unexpectedly active.

Fix it by setting the parsing options to a sane known value.
For API calls that depend on global state we introduce
PHP_LIBXML_SANITIZE_GLOBALS() and PHP_LIBXML_RESTORE_GLOBALS().
For other APIs that work directly with a context we introduce
php_libxml_sanitize_parse_ctxt_options().
2023-07-31 15:40:48 -05:00
..
2022-06-25 07:39:55 +01:00
2022-07-27 12:13:32 +02:00
2022-09-13 11:33:09 +01:00
2023-07-18 19:21:13 +02:00
2022-04-25 14:29:44 +02:00
2023-03-27 16:33:36 +02:00
2022-06-13 14:43:51 +02:00
2023-07-04 10:28:59 +02:00
2023-03-27 16:33:36 +02:00
2023-07-11 13:57:17 +02:00
2023-03-01 23:02:03 +01:00
2023-03-27 16:33:36 +02:00