[php-src] PR #22466: Fix use-after-free in RecursiveIteratorIterator on reentry
| From: | iliaal | Date: | Fri, 26 Jun 2026 13:11:47 +0000 |
| Subject: | [php-src] PR #22466: Fix use-after-free in RecursiveIteratorIterator on reentry | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36666@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22466
Author: iliaal
A RecursiveIterator whose next() calls rewind() (or next()) on the RecursiveIteratorIterator
wrapping it triggers a use-after-free: the move-forward loop caches the current sub-iterator, the
inner move_forward() re-enters userland, the reentrant rewind() frees that sub-iterator, and the
following validity check then reads freed memory. Re-fetching the sub-iterator after the inner call
closes the window, mirroring the level re-check the no-more-elements branch already does after
endChildren().