summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2021-01-28 17:00:16 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2021-02-01 12:57:40 +0100
commit7e9479083d6dc6d84c393a96eb718bccc0185b9b (patch)
tree347d95e6e17c13182e82277e56be7957376bdc60 /ext
parent217b9e7b41ffa009ea8047ba4868913bf55b1b32 (diff)
downloadphp-git-7e9479083d6dc6d84c393a96eb718bccc0185b9b.tar.gz
Fix #80654: file_get_contents() maxlen fails above (2**31)-1 bytes
We remove the arbitrary restriction to `INT_MAX`; it is superfluous on 32bit systems where `ZEND_LONG_MAX == INT_MAX` anyway, and not useful on 64bit systems, where larger files should be readable, if the `memory_limit` is large enough. Closes GH-6648.
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/file.c4
-rw-r--r--ext/standard/streamsfuncs.c4
2 files changed, 0 insertions, 8 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 12c21c93cd..3bd3421603 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -564,10 +564,6 @@ PHP_FUNCTION(file_get_contents)
RETURN_FALSE;
}
- if (maxlen > INT_MAX) {
- php_error_docref(NULL, E_WARNING, "maxlen truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
- maxlen = INT_MAX;
- }
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) {
RETVAL_STR(contents);
} else {
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 68ad6483e8..907feba741 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -456,10 +456,6 @@ PHP_FUNCTION(stream_get_contents)
}
}
- if (maxlen > INT_MAX) {
- php_error_docref(NULL, E_WARNING, "maxlen truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
- maxlen = INT_MAX;
- }
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0))) {
RETURN_STR(contents);
} else {