Commit 5e021664d84 for php.net
commit 5e021664d84465d9b020bacd257fc407697b408f
Author: Julien Voisin <jvoisin@users.noreply.github.com>
Date: Sat Sep 19 19:10:58 2026 +0200
Fix a non-exploitable integer overflow in mhash_keygen_s2k (#23770)
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 4a0b0c49437..8a4e857c9c1 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -1327,7 +1327,7 @@ PHP_FUNCTION(mhash_keygen_s2k)
context = php_hash_alloc_context(ops);
ops->hash_init(context, NULL);
- key = ecalloc(1, times * block_size);
+ key = ecalloc(times, block_size);
digest = emalloc(ops->digest_size + 1);
for (i = 0; i < times; i++) {