[php-src] PHP-8.5.9: Revert "Fix GH-21986: PharData::getContent() crash on infinite recursion with symlinks."

From: Date: Tue, 28 Jul 2026 12:56:58 +0000
Subject: [php-src] PHP-8.5.9: Revert "Fix GH-21986: PharData::getContent() crash on infinite recursion with symlinks."
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-140271@lists.php.net to get a copy of this message
Author: Ilija Tovilo (iluuu1994) Pusher: edorian Date: 2026-07-28T11:14:55+02:00 Commit: https://github.com/php/php-src/commit/5cb2a5ea28984f102a5f0afb09fafdb18663bf71 Raw diff: https://github.com/php/php-src/commit/5cb2a5ea28984f102a5f0afb09fafdb18663bf71.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 ebc2905a3243..a85bf92d719a 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -66,34 +66,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; } /* }}} */

« previous php.cvs (#140271) next »