Skip to content

Fix GH-22062: SplDoublyLinkedList iterator UAF via destructor releasi…#22066

Closed
devnexen wants to merge 1 commit into
php:masterfrom
devnexen:gh22062
Closed

Fix GH-22062: SplDoublyLinkedList iterator UAF via destructor releasi…#22066
devnexen wants to merge 1 commit into
php:masterfrom
devnexen:gh22062

Conversation

@devnexen
Copy link
Copy Markdown
Member

…ng next node.

Pin the new traverse target via SPL_LLIST_CHECK_ADDREF before the shift/pop destructor runs. Otherwise a destructor that unlinks the next node (e.g. offsetUnset) frees it, leaving the iterator with a dangling pointer.

…asing next node.

Pin the new traverse target via SPL_LLIST_CHECK_ADDREF before the
shift/pop destructor runs. Otherwise a destructor that unlinks the
next node (e.g. offsetUnset) frees it, leaving the iterator with a
dangling pointer.
@devnexen devnexen linked an issue May 16, 2026 that may be closed by this pull request
@devnexen devnexen marked this pull request as ready for review May 16, 2026 20:51
@devnexen devnexen requested a review from Girgias as a code owner May 16, 2026 20:51
Copy link
Copy Markdown
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be backported?

@devnexen
Copy link
Copy Markdown
Member Author

devnexen commented May 18, 2026

right I was not sure @iluuu1994 would agree due to the nature of the bug report (super crafted code). but I always can.

@iluuu1994
Copy link
Copy Markdown
Member

Indeed, imo such changes should go to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SplDoublyLinkedList iterator UAF via destructor releasing next node

3 participants