[php-src] PR #25907: Fix GH-25906: Use-after-free when SplHeap::compare() reads the heap during next()

From: Date: Sun, 29 Nov 2026 21:31:05 +0000
Subject: [php-src] PR #25907: Fix GH-25906: Use-after-free when SplHeap::compare() reads the heap during next()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41216@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25907 Author: thunderer Fixes GH-25906. spl_ptr_heap_delete_top() now moves the top element into a local buffer for next() and the iterator too, as it already does for extract(), and destroys it at the end, after the heap is consistent again. Before 9173c21a35e, next() destroyed it after the sift-down as well. During the sift-down, top() returns the element that is being removed, as it does in extract(). The destructor of the removed element now runs after the write lock is released, so next() behaves like extract() with the result discarded. A destructor can use the heap, and an exception from it no longer marks the heap as corrupted. extract(), insert() and calls without a user callback are unchanged.

« previous php.git-pulls (#41216) next »