com php-src: Fixed bug #72505 (readfile() mangles files larger than 2G): NEWS main/streams/streams.c
| From: | Xinchen Hui | Date: | Tue, 28 Jun 2016 03:11:25 +0000 |
| Subject: | com php-src: Fixed bug #72505 (readfile() mangles files larger than 2G): NEWS main/streams/streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92685@lists.php.net to get a copy of this message | ||
Commit: c73a2f7f45fc4ad6bf45f5f6929606725f285cd7
Author: Xinchen Hui <laruence@gmail.com> Tue, 28 Jun 2016 11:11:25 +0800
Parents: ad32c7b538de017d8273ecd00bb3710d7a9c586a
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c73a2f7f45fc4ad6bf45f5f6929606725f285cd7
Log:
Fixed bug #72505 (readfile() mangles files larger than 2G)
Bugs:
https://bugs.php.net/72505
Changed paths:
M NEWS
M main/streams/streams.c
Diff:
diff --git a/NEWS b/NEWS
index 68eea45..816a20f 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ PHP NEWS
. Fixed bug #72463 (mail fails with invalid argument). (Anatol)
- Standard:
+ . Fixed bug #72505 (readfile() mangles files larger than 2G). (Cschneid)
. Fixed bug #72306 (Heap overflow through proc_open and $env parameter).
(Laruence)
diff --git a/main/streams/streams.c b/main/streams/streams.c
index d64d5ca...e21d21a 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams..c
@@ -1396,7 +1396,7 @@ PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC)
if (p) {
do {
/* output functions return int, so pass in int max */
- if (0 < (b = PHPWRITE(p, MIN(mapped - bcount, INT_MAX)))) {
+ if (0 < (b = PHPWRITE(p + bcount, MIN(mapped - bcount, INT_MAX)))) {
bcount += b;
}
} while (b > 0 && mapped > bcount);