[php-src] PHP-8.4.24: Revert "Fix GH-21986: PharData::getContent() crash on infinite recursion with symlinks."
Ilija Tovilo <[email protected]> Wed, 29 Jul 2026 05:23:27 +0000
| Newsgroups | gmane.comp.php.cvs.general |
|---|---|
| Message-ID | <[email protected]> |
Author: Ilija Tovilo (iluuu1994)
Pusher: NattyNarwhal
Date: 2026-07-28T11:09:58+02:00
Commit: https://github.com/php/php-src/commit/4ffb33e6796f0c16c9844a58c15105320abe611e
Raw diff: https://github.com/php/php-src/commit/4ffb33e6796f0c16c9844a58c15105320abe611e.diff
Revert "Fix GH-21986: PharData::getContent() crash on infinite recursion with symlinks."
This reverts commit b2de3cf170f81b203dfc2622f2f2dd1572ef95be.
Changed paths:
M ext/phar/util.c
Diff:
diff --git a/ext/phar/util.c b/ext/phar/util.c
index 2c896c6f6588..2d1db6a1b3e1 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -64,34 +64,24 @@ phar_entry_info *phar_get_link_source(phar_entry_info *entry) /* {{{ */
{
phar_entry_info *link_entry;
char *link;
- uint32_t depth = 0, max_depth;
if (!entry->link) {
return entry;
}
- max_depth = zend_hash_num_elements(&(entry->phar->manifest));
-
- while (entry->link) {
- if (UNEXPECTED(++depth > max_depth)) {
- return NULL;
+ link = phar_get_link_location(entry);
+ if (NULL != (link_entry = zend_hash_str_find_ptr(&(entry->phar->manifest), entry->link, strlen(entry->link))) ||
+ NULL != (link_entry = zend_hash_str_find_ptr(&(entry->phar->manifest), link, strlen(link)))) {
+ if (link != entry->link) {
+ efree(link);
}
- link = phar_get_link_location(entry);
-
- if (NULL != (link_entry = zend_hash_str_find_ptr(&(entry->phar->manifest), entry->link, strlen(entry->link))) ||
- NULL != (link_entry = zend_hash_str_find_ptr(&(entry->phar->manifest), link, strlen(link)))) {
- if (link != entry->link) {
- efree(link);
- }
- entry = link_entry;
- } else {
- if (link != entry->link) {
- efree(link);
- }
- return NULL;
+ return phar_get_link_source(link_entry);
+ } else {
+ if (link != entry->link) {
+ efree(link);
}
+ return NULL;
}
- return entry;
}
/* }}} */