From ea9fac94bbae150a81fde0e6542e6b45965772cd Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Thu, 3 Nov 2016 20:36:52 -0700 Subject: More string length checks & fixes --- ext/standard/php_smart_str.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/standard/php_smart_str.h') diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h index edd9d3a89f..a336660987 100644 --- a/ext/standard/php_smart_str.h +++ b/ext/standard/php_smart_str.h @@ -57,7 +57,8 @@ newlen = (n); \ (d)->a = newlen < SMART_STR_START_SIZE \ ? SMART_STR_START_SIZE \ - : newlen + SMART_STR_PREALLOC; \ + : (newlen >= (INT_MAX - SMART_STR_PREALLOC)? newlen \ + : (newlen + INT_MAX)); \ SMART_STR_DO_REALLOC(d, what); \ } else { \ newlen = (d)->len + (n); \ -- cgit v1.2.1