wez Wed Apr 21 08:02:47 2004 EDT Modified files: /php-src NEWS /php-src/main/streams mmap.c Log: Fixed bug #19749 (shouldn't mmap() files larger than memory_limit) http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1689&r2=1.1690&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1689 php-src/NEWS:1.1690 --- php-src/NEWS:1.1689 Wed Apr 21 04:57:16 2004 +++ php-src/NEWS Wed Apr 21 08:02:47 2004 @@ -41,6 +41,7 @@ - Fixed bug #27397 (debug_backtrace() not showing function arguments). (Zeev) - Fixed bug #27283 (The last catch statement was sometimes skipped). (Andi) - Fixed bug #26441 (When __set() returned a value it corrupted it). (Andi) +- Fixed bug #19749 (shouldn't mmap() files larger than memory_limit). (Wez) 18 March 2004, PHP 5 Release Candidate 1 - Fixed numerous bugs with the just-in-time auto-global initialization, that http://cvs.php.net/diff.php/php-src/main/streams/mmap.c?r1=1.4&r2=1.5&ty=u Index: php-src/main/streams/mmap.c diff -u php-src/main/streams/mmap.c:1.4 php-src/main/streams/mmap.c:1.5 --- php-src/main/streams/mmap.c:1.4 Thu Jan 8 03:17:59 2004 +++ php-src/main/streams/mmap.c Wed Apr 21 08:02:47 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mmap.c,v 1.4 2004/01/08 08:17:59 andi Exp $ */ +/* $Id: mmap.c,v 1.5 2004/04/21 12:02:47 wez Exp $ */ /* Memory Mapping interface for streams */ #include "php.h" @@ -31,7 +31,11 @@ range.mode = mode; range.mapped = NULL; - /* TODO: Enforce system policy and limits for mmap sizes ? */ + /* For now, we impose an arbitrary 1MB limit to avoid + * runaway swapping when large files are passed thru. */ + if (length > 1 * 1024 * 1024) { + return NULL; + } if (PHP_STREAM_OPTION_RETURN_OK == php_stream_set_option(stream, PHP_STREAM_OPTION_MMAP_API, PHP_STREAM_MMAP_MAP_RANGE, &range)) { if (mapped_len) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php