[Pkg-php-commits] [php/debian-sid] Import patch to don't mmap large >4GB files from Ubuntu

Ondřej Surý ondrej at sury.org
Fri Mar 18 08:38:09 UTC 2011


---
 debian/patches/lp564920-fix-big-files.patch |   22 ++++++++++++++++++++++
 debian/patches/series                       |    1 +
 2 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 debian/patches/lp564920-fix-big-files.patch

diff --git a/debian/patches/lp564920-fix-big-files.patch b/debian/patches/lp564920-fix-big-files.patch
new file mode 100644
index 0000000..a8a647e
--- /dev/null
+++ b/debian/patches/lp564920-fix-big-files.patch
@@ -0,0 +1,22 @@
+Description: don't mmap large files
+Author: Marc Deslauriers <marc.deslauriers at ubuntu.com>
+Bug: http://bugs.php.net/bug.php?id=52102
+Ubuntu-Bug: https://bugs.edge.launchpad.net/ubuntu/+source/php5/+bug/564920
+
+--- a/main/streams/plain_wrapper.c
++++ b/main/streams/plain_wrapper.c
+@@ -629,7 +629,13 @@ static int php_stdiop_set_option(php_str
+ 				
+ 				switch (value) {
+ 					case PHP_STREAM_MMAP_SUPPORTED:
+-						return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
++						if (fd == -1)
++							return PHP_STREAM_OPTION_RETURN_ERR;
++						/* Don't mmap large files */
++						do_fstat(data, 1);
++						if (data->sb.st_size > 4 * 1024 * 1024)
++							return PHP_STREAM_OPTION_RETURN_ERR;
++						return PHP_STREAM_OPTION_RETURN_OK;
+ 
+ 					case PHP_STREAM_MMAP_MAP_RANGE:
+ 						do_fstat(data, 1);
diff --git a/debian/patches/series b/debian/patches/series
index 6a8f642..d97bb4f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -60,3 +60,4 @@ fix-segfault-when-node-is-NULL-in-simplexml.patch
 fix-segfault-when-using-several-cloned-intl-objects.patch
 php-fpm-sysconfdir.patch
 configure-as-needed.patch
+lp564920-fix-big-files.patch
-- 
1.7.1




More information about the Pkg-php-commits mailing list