[php-src] PR #25958: Fix GH-25957: Segfault when a stream finalizes the HashContext during hash_update_stream() or hash_update_file()

From: Date: Mon, 30 Nov 2026 16:41:49 +0000
Subject: [php-src] PR #25958: Fix GH-25957: Segfault when a stream finalizes the HashContext during hash_update_stream() or hash_update_file()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41264@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25958 Author: thunderer Fixes GH-25957. hash_update_stream() and hash_update_file() check the context once, before the loop. php_stream_read() can run user code (stream_open() or stream_read() of a stream wrapper, or a php_user_filter), and hash_final() there frees the context. The fix checks the context again after each read and throws the same TypeError as for a context that was finalized before the call. hash_update_file() closes its stream before it throws. The in_use flag in #23997 would also cover this, but it adds a field to php_hashcontext_object in php_hash.h, which changes the ABI on a stable branch.

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