From: Debian PHP Maintainers Date: Sat, 2 May 2015 08:26:54 +0000 (+0200) Subject: lp564920-fix-big-files X-Git-Tag: archive/raspbian/8.2.27-1+rpi1^2~35 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=780da6dcbe747eea728e396a9d5c6afd9e1e1c7c;p=php8.2.git lp564920-fix-big-files Gbp-Pq: Name 0014-lp564920-fix-big-files.patch --- diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index c92b76d1..f484a7dd 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -750,7 +750,13 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void 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: if (do_fstat(data, 1) != 0) {