You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segfault when a stream finalizes the HashContext during hash_update_stream() or hash_update_file() #25957
Fatal error: Uncaught TypeError: hash_update_stream(): Argument #1 ($context) must be a valid, non-finalized HashContext
hash_update_stream() and hash_update_file() check the context once, before the loop. A user stream wrapper (stream_open() or stream_read()) or a php_user_filter runs during php_stream_read(). If it calls hash_final(), the context is freed and set to NULL, and the next hash_update call uses the NULL context. hash_update_file() crashes in the same way (ext/hash/hash.c:777).
I have a patch with a test and will open a PR against PHP-8.4.
PHP Version
PHP 8.5.12 (cli) (built: Oct 28 2026 01:20:43) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.5.12, Copyright (c) Zend Technologies
with Zend OPcache v8.5.12, Copyright (c), by Zend Technologies
Also reproduced with PHP 7.4 to 8.6 (official Docker images) and the current PHP-8.4, PHP-8.5, PHP-8.6 and master branches.
Activity
Fix phpGH-25957: Segfault when a stream finalizes the HashContext dur…
Fix phpGH-25957: Segfault when a stream finalizes the HashContext dur…