[php-src] PR #21668: Fix GH-18173: ext/hash relies on implementation-defined malloc alignment

From: Date: Tue, 07 Apr 2026 23:47:24 +0000
Subject: [php-src] PR #21668: Fix GH-18173: ext/hash relies on implementation-defined malloc alignment
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-35614@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/21668 Author: iliaal ## Summary XXH3_state_t requires 64-byte alignment for its internal buffers. php_hash_alloc_context() used ecalloc(), which only guarantees alignof(max_align_t) (16 bytes on x86_64). When the allocator returned a pointer that wasn't 64-byte aligned, xxhash's aligned loads segfaulted. Adds a context_align field to php_hash_ops. When non-zero, php_hash_alloc_context() over-allocates and manually aligns the pointer, storing the offset byte so php_hash_free_context() can recover the original allocation. Set to 64 for xxh3 and xxh128. Reproduce with ZEND_MM_DEBUG=padding=8 TESTS=ext/hash make test.

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