iliaa Thu Jul 31 15:48:05 2003 EDT Modified files: (Branch: PHP_4_3) /php-src NEWS /php-src/main output.c Log: MFH: Fixed bug #22154 (Possible crash when memory_limit is reached and output buffering in addition to session.use_trans_sid is used). Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.314 php-src/NEWS:1.1247.2.315 --- php-src/NEWS:1.1247.2.314 Wed Jul 30 13:57:19 2003 +++ php-src/NEWS Thu Jul 31 15:48:05 2003 @@ -1,5 +1,9 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? Aug 2003, Version 4.3.3RC3 +- Fixed bug #22154 (Possible crash when memory_limit is reached and + output buffering in addition to session.use_trans_sid is used). (Ilia) + 30 Jul 2003, Version 4.3.3RC2 - Improved the NSAPI SAPI module (Uwe Schindler) . Added possibility to use PHP to generate HTTP error pages (404 Not Found..) Index: php-src/main/output.c diff -u php-src/main/output.c:1.142.2.13 php-src/main/output.c:1.142.2.14 --- php-src/main/output.c:1.142.2.13 Wed Jul 16 04:45:31 2003 +++ php-src/main/output.c Thu Jul 31 15:48:05 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.142.2.13 2003/07/16 08:45:31 sniper Exp $ */ +/* $Id: output.c,v 1.142.2.14 2003/07/31 19:48:05 iliaa Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -379,15 +379,20 @@ /* {{{ php_ob_allocate */ -static inline void php_ob_allocate(TSRMLS_D) +static inline void php_ob_allocate(uint text_length TSRMLS_DC) { - if (OG(active_ob_buffer).size<OG(active_ob_buffer).text_length) { - while (OG(active_ob_buffer).size <= OG(active_ob_buffer).text_length) { - OG(active_ob_buffer).size+=OG(active_ob_buffer).block_size; + uint new_len = OG(active_ob_buffer).text_length + text_length; + + if (OG(active_ob_buffer).size < new_len) { + uint buf_size = OG(active_ob_buffer).size; + while (buf_size <= new_len) { + buf_size += OG(active_ob_buffer).block_size; } - - OG(active_ob_buffer).buffer = (char *) erealloc(OG(active_ob_buffer).buffer, OG(active_ob_buffer).size+1); + + OG(active_ob_buffer).buffer = (char *) erealloc(OG(active_ob_buffer).buffer, buf_size+1); + OG(active_ob_buffer).size = buf_size; } + OG(active_ob_buffer).text_length = new_len; } /* }}} */ @@ -592,9 +597,8 @@ int original_ob_text_length; original_ob_text_length=OG(active_ob_buffer).text_length; - OG(active_ob_buffer).text_length = OG(active_ob_buffer).text_length + text_length; - php_ob_allocate(TSRMLS_C); + php_ob_allocate(text_length TSRMLS_CC); target = OG(active_ob_buffer).buffer+original_ob_text_length; memcpy(target, text, text_length); target[text_length]=0; @@ -619,8 +623,7 @@ char *p, *start; TSRMLS_FETCH(); - OG(active_ob_buffer).text_length += text_length; - php_ob_allocate(TSRMLS_C); + php_ob_allocate(text_length TSRMLS_CC); /* php_ob_allocate() may change OG(ob_buffer), so we can't initialize p&start earlier */ p = OG(ob_buffer)+OG(ob_text_length);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php