Skip to content

Commit d6fcaf5

Browse files
committed
Fixed bug #80457
On x32 sizeof(size_t) != sizeof(zend_long), so we need to be careful with sign extension here. Patch by bruno dot premont at restena dot lu.
1 parent 6857081 commit d6fcaf5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.3.26
44

5+
- Standard:
6+
. Fixed bug #80457 (stream_get_contents() fails with maxlength=-1 or default).
7+
(bruno dot premont at restena dot lu)
58

69
26 Nov 2020, PHP 7.3.25
710

ext/standard/streamsfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ PHP_FUNCTION(stream_get_contents)
442442
Z_PARAM_LONG(desiredpos)
443443
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
444444

445-
if (maxlen < 0 && maxlen != PHP_STREAM_COPY_ALL) {
445+
if (maxlen < 0 && maxlen != (ssize_t)PHP_STREAM_COPY_ALL) {
446446
php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to zero, or -1");
447447
RETURN_FALSE;
448448
}

0 commit comments

Comments
 (0)