[php-src] PR #25823: Fix GH-25817: UAF when a userspace stream_truncate() closes the stream
| From: | lazerg | Date: | Fri, 27 Nov 2026 07:57:12 +0000 |
| Subject: | [php-src] PR #25823: Fix GH-25817: UAF when a userspace stream_truncate() closes the stream | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41096@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25823
Author: lazerg
Fixes GH-25817
Same gap as GH-25586:
stream_truncate() was still called without
PHP_STREAM_FLAG_NO_FCLOSE set, so an fclose() from inside it freed the
stream while ftruncate() was still using it. When stream_truncate() then
returns a non-bool, the warning reads the freed userspace stream data (ASAN reports a
heap-use-after-free in user_stream_set_truncation()). This sets the flag around the
truncate call, so the fclose() there only warns, like it does for the other handlers.