From 48b492269b9761d0cc606667cf20521c7c1b6449 Mon Sep 17 00:00:00 2001 From: txuna Date: Mon, 26 May 2025 13:25:21 +0000 Subject: [PATCH] Fix GH-18595: fpm_get_status segfault This fixes null dereference error when calling fpm_get_status() and one of the children is just being created. Closes GH-18662 Co-authored-by: Jakub Zelenka --- NEWS | 3 +++ sapi/fpm/fpm/fpm_request.c | 1 + sapi/fpm/fpm/fpm_request.h | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 379718ba2a9..3b3900afff9 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,9 @@ PHP NEWS - Date: . Fix leaks with multiple calls to DatePeriod iterator current(). (nielsdos) +- FPM: + . Fixed GH-18662 (fpm_get_status segfault). (txuna) + - Intl: . Fix memory leak in intl_datetime_decompose() on failure. (nielsdos) diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c index 0eb75884d36..9ea7d8aeaaa 100644 --- a/sapi/fpm/fpm/fpm_request.c +++ b/sapi/fpm/fpm/fpm_request.c @@ -22,6 +22,7 @@ #include "zlog.h" static const char *requests_stages[] = { + [FPM_REQUEST_CREATING] = "Creating", [FPM_REQUEST_ACCEPTING] = "Idle", [FPM_REQUEST_READING_HEADERS] = "Reading headers", [FPM_REQUEST_INFO] = "Getting request information", diff --git a/sapi/fpm/fpm/fpm_request.h b/sapi/fpm/fpm/fpm_request.h index c1cde0111be..1dcc7f78902 100644 --- a/sapi/fpm/fpm/fpm_request.h +++ b/sapi/fpm/fpm/fpm_request.h @@ -25,7 +25,8 @@ const char *fpm_request_get_stage_name(int stage); int fpm_request_last_activity(struct fpm_child_s *child, struct timeval *tv); enum fpm_request_stage_e { - FPM_REQUEST_ACCEPTING = 1, + FPM_REQUEST_CREATING, + FPM_REQUEST_ACCEPTING, FPM_REQUEST_READING_HEADERS, FPM_REQUEST_INFO, FPM_REQUEST_EXECUTING,