com php-src: Fixed bug #77329 (Buffer Overflow via overly long Error Messages): NEWS Zend/zend_smart_str.c

From: Date: Fri, 01 Feb 2019 08:11:15 +0000
Subject: com php-src: Fixed bug #77329 (Buffer Overflow via overly long Error Messages): NEWS Zend/zend_smart_str.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-104418@lists.php.net to get a copy of this message
Commit: 203a2da30ae6722689e3625ac3c787c560a791a9 Author: Dmitry Stogov <dmitry@zend.com> Fri, 1 Feb 2019 11:11:15 +0300 Parents: 7d1df603ada38814dbf4728950bc7f9d0a636864 Branches: PHP-7.3 PHP-7.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=203a2da30ae6722689e3625ac3c787c560a791a9 Log: Fixed bug #77329 (Buffer Overflow via overly long Error Messages) Bugs: https://bugs.php.net/77329 Changed paths: M NEWS M Zend/zend_smart_str.c Diff: diff --git a/NEWS b/NEWS index d94a6f4..6766c61 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? ????, PHP 7.3.3 - Core: + . Fixed bug #77329 (Buffer Overflow via overly long Error Messages). + (Dmitry) . Fixed bug #77494 (Disabling class causes segfault on member access). (Dmitry) . Fixed bug #77498 (Custom extension Segmentation fault when declare static diff --git a/Zend/zend_smart_str.c b/Zend/zend_smart_str.c index 0e34f12..e13741f 100644 --- a/Zend/zend_smart_str.c +++ b/Zend/zend_smart_str.c @@ -155,7 +155,12 @@ ZEND_API void ZEND_FASTCALL _smart_string_alloc(smart_string *str, size_t len) str->c = emalloc(SMART_STRING_START_LEN + 1); } else { str->a = ZEND_MM_ALIGNED_SIZE_EX(len + SMART_STRING_OVERHEAD, SMART_STRING_PAGE) - SMART_STRING_OVERHEAD; - str->c = emalloc_large(str->a + 1); + if (EXPECTED(str->a < (ZEND_MM_CHUNK_SIZE - SMART_STRING_OVERHEAD))) { + str->c = emalloc_large(str->a + 1); + } else { + /* allocate a huge chunk */ + str->c = emalloc(str->a + 1); + } } } else { if (UNEXPECTED((size_t) len > SIZE_MAX - str->len)) {

« previous php.cvs (#104418) next »