iliaa           Mon Nov 15 18:44:14 2004 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src    NEWS 
    /php-src/main       php_streams.h 
    /php-src/main/streams       streams.c 
  Log:
  MFH: Fixed bug #29801 (Set limit on the size of mmapable data).
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.124&r2=1.1760.2.125&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.124 php-src/NEWS:1.1760.2.125
--- php-src/NEWS:1.1760.2.124   Mon Nov 15 11:42:10 2004
+++ php-src/NEWS        Mon Nov 15 18:44:13 2004
@@ -8,6 +8,7 @@
 - Extended the functionality of is_subclass_of() to accept either a class name
   or an object as first parameter. (Andrey) 
 - Fixed potential problems with unserializing invalid serialize data. (Marcus)
+- Fixed bug #29801 (Set limit on the size of mmapable data). (Ilia)
 - Fixed bug #30783 (Apache crash when using ReflectionFunction::
   getStaticVariables()). (Marcus)
 - Fixed bug #30750 (Meaningful error message when upload directory is not 
http://cvs.php.net/diff.php/php-src/main/php_streams.h?r1=1.95&r2=1.95.2.1&ty=u
Index: php-src/main/php_streams.h
diff -u php-src/main/php_streams.h:1.95 php-src/main/php_streams.h:1.95.2.1
--- php-src/main/php_streams.h:1.95     Mon Jun 21 17:08:05 2004
+++ php-src/main/php_streams.h  Mon Nov 15 18:44:14 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_streams.h,v 1.95 2004/06/21 21:08:05 pollita Exp $ */
+/* $Id: php_streams.h,v 1.95.2.1 2004/11/15 23:44:14 iliaa Exp $ */
 
 #ifndef PHP_STREAMS_H
 #define PHP_STREAMS_H
@@ -410,8 +410,11 @@
 #define PHP_STREAM_OPTION_RETURN_NOTIMPL       -2 /* underlying stream does 
not implement; streams can handle it instead */
 
 /* copy up to maxlen bytes from src to dest.  If maxlen is 
PHP_STREAM_COPY_ALL, copy until eof(src).
- * Uses mmap if the src is a plain file and at offset 0 */
-#define PHP_STREAM_COPY_ALL            -1
+ * Uses mmap if the src is a plain file and at offset 0 
+ * To ensure we don't take up too much memory when reading large files, set 
the default mmap length
+ * at this many bytes */
+#define PHP_STREAM_COPY_ALL            2000000
+
 BEGIN_EXTERN_C()
 PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, 
size_t maxlen STREAMS_DC TSRMLS_DC);
 #define php_stream_copy_to_stream(src, dest, maxlen)   
_php_stream_copy_to_stream((src), (dest), (maxlen) STREAMS_CC TSRMLS_CC)
http://cvs.php.net/diff.php/php-src/main/streams/streams.c?r1=1.61.2.4&r2=1.61.2.5&ty=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.61.2.4 
php-src/main/streams/streams.c:1.61.2.5
--- php-src/main/streams/streams.c:1.61.2.4     Thu Nov 11 08:09:03 2004
+++ php-src/main/streams/streams.c      Mon Nov 15 18:44:14 2004
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.61.2.4 2004/11/11 13:09:03 rrichards Exp $ */
+/* $Id: streams.c,v 1.61.2.5 2004/11/15 23:44:14 iliaa Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -1151,7 +1151,7 @@
                char *p;
                size_t mapped;
 
-               p = php_stream_mmap_range(stream, php_stream_tell(stream), 0, 
PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
+               p = php_stream_mmap_range(stream, php_stream_tell(stream), 
PHP_STREAM_COPY_ALL, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
 
                if (p) {
                        PHPWRITE(p, mapped);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to