Skip to content

Commit

Permalink
Fix unlikely memory leak in case of namespace removal with extremely …
Browse files Browse the repository at this point in the history
…deep trees
  • Loading branch information
nielsdos committed Feb 5, 2024
1 parent b710f6f commit ab508c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions NEWS
Expand Up @@ -5,6 +5,10 @@ PHP NEWS
- Curl:
. Fix failing tests due to string changes in libcurl 8.6.0. (Ayesh)

- DOM:
. Fix unlikely memory leak in case of namespace removal with extremely deep
trees. (nielsdos)

- FPM:
. Fixed bug #75712 (getenv in php-fpm should not read $_ENV, $_SERVER).
(Jakub Zelenka)
Expand All @@ -15,6 +19,8 @@ PHP NEWS
. Fixed array key as hash to string (case insensitive) comparison typo
for the second operand buffer size (albeit unused for now). (A. Slepykh)

5 Feb 2024, PHP 8.3.3

- Core:
. Fixed timer leak in zend-max-execution-timers builds. (withinboredom)
. Fixed bug GH-12349 (linking failure on ARM with mold). (Jan Palus)
Expand Down
3 changes: 2 additions & 1 deletion ext/dom/element.c
Expand Up @@ -461,7 +461,7 @@ static void dom_deep_ns_redef(xmlNodePtr node, xmlNsPtr ns_to_redefine)
if (worklist_size == worklist_capacity) {
if (UNEXPECTED(worklist_capacity >= SIZE_MAX / 3 * 2 / sizeof(dom_deep_ns_redef_item))) {
/* Shouldn't be possible to hit, but checked for safety anyway */
return;
goto out;
}
worklist_capacity = worklist_capacity * 3 / 2;
worklist = erealloc(worklist, sizeof(dom_deep_ns_redef_item) * worklist_capacity);
Expand All @@ -472,6 +472,7 @@ static void dom_deep_ns_redef(xmlNodePtr node, xmlNsPtr ns_to_redefine)
}
}

out:
efree(worklist);
}

Expand Down

0 comments on commit ab508c9

Please sign in to comment.