From af8fccee9c5a1c7302d9bfe1c7bd431374e59415 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 16 Sep 2021 16:07:09 +0200 Subject: [PATCH] Fix persistent smart_str allocation This would allocate a too small buffer if the first smart_str allocation is > SMART_STR_START_LEN but <= SMART_STR_START_SIZE. --- Zend/zend_smart_str.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_smart_str.c b/Zend/zend_smart_str.c index 1a5eb455ad8..2745dbf3f49 100644 --- a/Zend/zend_smart_str.c +++ b/Zend/zend_smart_str.c @@ -45,7 +45,7 @@ ZEND_API void ZEND_FASTCALL smart_str_erealloc(smart_str *str, size_t len) ZEND_API void ZEND_FASTCALL smart_str_realloc(smart_str *str, size_t len) { if (UNEXPECTED(!str->s)) { - str->a = len <= SMART_STR_START_SIZE + str->a = len <= SMART_STR_START_LEN ? SMART_STR_START_LEN : SMART_STR_NEW_LEN(len); str->s = zend_string_alloc(str->a, 1);