From 77a735bd7c552acb2861cd4bf31fd6a55c891b8d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 16 Nov 2026 13:00:09 +0100 Subject: [PATCH] Fix OPcache blacklist used after free when PHP starts again zend_accel_blacklist_shutdown() freed the regexps and the entries but kept pointing to the regexps and kept the number of entries. A later startup in the same process without opcache.blacklist_filename then used them. --- ext/opcache/zend_accelerator_blacklist.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c index c4a543e6207b..219966991af9 100644 --- a/ext/opcache/zend_accelerator_blacklist.c +++ b/ext/opcache/zend_accelerator_blacklist.c @@ -218,6 +218,7 @@ void zend_accel_blacklist_shutdown(zend_blacklist *blacklist) } free(blacklist->entries); blacklist->entries = NULL; + blacklist->pos = 0; if (blacklist->regexp_list) { zend_regexp_list *temp, *it = blacklist->regexp_list; while (it) { @@ -226,6 +227,7 @@ void zend_accel_blacklist_shutdown(zend_blacklist *blacklist) it = it->next; free(temp); } + blacklist->regexp_list = NULL; } }