From e0ca4dca5b1c704381ac42d55cb1a16634741ec9 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 23 Oct 2023 10:50:55 +0300 Subject: [PATCH] Fixed GH-12494: Zend/tests/arginfo_zpp_mismatch.phpt causes a segfault withJIT + --repeat 2 --- ext/opcache/zend_shared_alloc.c | 2 +- ext/opcache/zend_shared_alloc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index 37f6fea9199..f8644121572 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -252,7 +252,7 @@ int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size) free(ZSMMG(shared_segments)); ZSMMG(shared_segments) = tmp_shared_segments; - ZSMMG(shared_memory_state).positions = (int *)zend_shared_alloc(sizeof(int) * ZSMMG(shared_segments_count)); + ZSMMG(shared_memory_state).positions = (size_t *)zend_shared_alloc(sizeof(size_t) * ZSMMG(shared_segments_count)); if (!ZSMMG(shared_memory_state).positions) { zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!"); return ALLOC_FAILURE; diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h index 4e090b98dda..3b2da46cb3b 100644 --- a/ext/opcache/zend_shared_alloc.h +++ b/ext/opcache/zend_shared_alloc.h @@ -95,7 +95,7 @@ typedef struct _handler_entry { } zend_shared_memory_handler_entry; typedef struct _zend_shared_memory_state { - int *positions; /* current positions for each segment */ + size_t *positions; /* current positions for each segment */ size_t shared_free; /* amount of free shared memory */ } zend_shared_memory_state;