Skip to content

ext/spl: Fix use-after-free when ArrayObject::unserialize() replaces the storage - #25807

Open
Roman3349 wants to merge 1 commit into
php:PHP-8.4from
Roman3349:fix/spl-arrayobject-unserialize-release-order
Open

Roman3349 wants to merge 1 commit into
php:PHP-8.4from
Roman3349:fix/spl-arrayobject-unserialize-release-order

Conversation

@Roman3349

Copy link
Copy Markdown
Contributor

ArrayObject::unserialize() released the old array before storing the new one, so a destructor of an old element that accessed the ArrayObject saw the array being destroyed. Store the new array first, as spl_array_set_array() already does.

…:unserialize()

Signed-off-by: Roman Ondráček <mail@romanondracek.cz>
@Roman3349
Roman3349 requested a review from Girgias as a code owner November 26, 2026 21:27
@Roman3349
Roman3349 force-pushed the fix/spl-arrayobject-unserialize-release-order branch from 9565be7 to a28cb0c Compare November 26, 2026 21:29
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.

1 participant