[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Weilin Du | Date: | Tue, 08 Sep 2026 16:34:54 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141142@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-09-09T00:21:02+08:00
Commit: https://github.com/php/php-src/commit/9604be9c2737155101ad462731d34ab327641126
Raw diff: https://github.com/php/php-src/commit/9604be9c2737155101ad462731d34ab327641126.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Fix sparse set allocation size overflow (#23482)
Changed paths:
M ext/opcache/jit/ir/ir_private.h
Diff:
diff --git a/ext/opcache/jit/ir/ir_private.h b/ext/opcache/jit/ir/ir_private.h
index 3e1051ca3379..6d8f31a8b7ed 100644
--- a/ext/opcache/jit/ir/ir_private.h
+++ b/ext/opcache/jit/ir/ir_private.h
@@ -495,9 +495,12 @@ typedef struct _ir_sparse_set {
IR_ALWAYS_INLINE void ir_sparse_set_init(ir_sparse_set *set, uint32_t size)
{
+ size_t alloc_size = (size_t)size * 2 * sizeof(*set->data);
+
set->size = size;
set->len = 0;
- set->data = (uint32_t*)ir_mem_malloc(sizeof(uint32_t) * 2 * size) + size;
+ IR_ASSERT(!size || alloc_size / size == 2 * sizeof(*set->data));
+ set->data = (uint32_t*)ir_mem_malloc(alloc_size) + size;
#ifdef IR_DEBUG
/* initialize sparse part to avoid valgrind warnings */
memset(&IR_SPARSE_SET_SPARSE(set, size - 1), 0, size * sizeof(uint32_t));