Hi,
This patch should be removed when re2c EOF handling issue will be resolved.
Thanks. Dmitry.
Dmitry Stogov wrote:
dmitry Tue Apr 28 07:13:31 2009 UTC
Modified files: (Branch: PHP_5_3)
/php-src NEWS
/php-src/main main.c
Log:
Fixed bug #48034 (PHP crashes when script is 8192 (8KB) bytes long)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.570&r2=1.2027.2.547.2.965.2.571&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.570
php-src/NEWS:1.2027.2.547.2.965.2.571
--- php-src/NEWS:1.2027.2.547.2.965.2.570 Mon Apr 27 18:45:12 2009
+++ php-src/NEWS Tue Apr 28 07:13:30 2009
@@ -17,6 +17,7 @@
- Fixed bug #48087 (call_user_method() invalid free of arguments). (Felipe)
- Fixed bug #48060 (pdo_pgsql - large objects are returned as empty). (Matteo)
+- Fixed bug #48034 (PHP crashes when script is 8192 (8KB) bytes long). (Dmitry)
- Fixed bug #48023 (spl_autoload_register didn't store closures). (Etienne)
- Fixed bug #48004 (Error handler prevents creation of default object).
(Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.57.2.47&r2=1.640.2.23.2.57.2.48&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.57.2.47
php-src/main/main.c:1.640.2.23.2.57.2.48
--- php-src/main/main.c:1.640.2.23.2.57.2.47 Fri Mar 27 02:34:06 2009
+++ php-src/main/main.c Tue Apr 28 07:13:30 2009
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.640.2.23.2.57.2.47 2009/03/27 02:34:06 lbarnaud Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.57.2.48 2009/04/28 07:13:30 dmitry Exp $ */
/* {{{ includes
*/
@@ -89,6 +89,13 @@
#include "SAPI.h"
#include "rfc1867.h"
+
+#if HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+# ifndef PAGE_SIZE
+# define PAGE_SIZE 4096
+# endif
+#endif
/* }}} */
PHPAPI int (*php_register_internal_extensions_func)(TSRMLS_D) = php_register_internal_extensions;
@@ -1134,8 +1141,10 @@
handle->handle.stream.isatty = 0;
/* can we mmap immeadiately? */
memset(&handle->handle.stream.mmap, 0,
sizeof(handle->handle.stream.mmap));
- len = php_zend_stream_fsizer(stream TSRMLS_CC) +
ZEND_MMAP_AHEAD;
- if (php_stream_mmap_possible(stream)
+ len = php_zend_stream_fsizer(stream TSRMLS_CC);
+ if (len != 0
+ && ((len - 1) % PAGE_SIZE) <= PAGE_SIZE - ZEND_MMAP_AHEAD
+ && php_stream_mmap_possible(stream)
&& (p = php_stream_mmap_range(stream, 0, len,
PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped_len)) != NULL) {
handle->handle.stream.closer =
php_zend_stream_mmap_closer;
handle->handle.stream.mmap.buf = p;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php