File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ PHP NEWS
48
48
. Fixed bug #72278 (getimagesize returning FALSE on valid jpg). (cmb)
49
49
. Fixed bug #65550 (get_browser() incorrectly parses entries with "+" sign).
50
50
(cmb)
51
+ . Fixed bug #71882 (Negative ftruncate() on php://memory exhausts memory).
52
+ (cmb)
51
53
52
54
- XML:
53
55
. Fixed bug #72085 (SEGV on unknown address zif_xml_parse). (cmb)
Original file line number Diff line number Diff line change @@ -1512,6 +1512,11 @@ PHP_NAMED_FUNCTION(php_if_ftruncate)
1512
1512
RETURN_FALSE ;
1513
1513
}
1514
1514
1515
+ if (size < 0 ) {
1516
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Negative size is not supported" );
1517
+ RETURN_FALSE ;
1518
+ }
1519
+
1515
1520
PHP_STREAM_TO_ZVAL (stream , & fp );
1516
1521
1517
1522
if (!php_stream_truncate_supported (stream )) {
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #71882 (Negative ftruncate() on php://memory exhausts memory)
3
+ --FILE--
4
+ <?php
5
+ $ fd = fopen ("php://memory " , "w+ " );
6
+ ftruncate ($ fd , -1 );
7
+ ?>
8
+ ==DONE==
9
+ --EXPECTF--
10
+ Warning: ftruncate(): Negative size is not supported in %s%ebug71882.php on line %d
11
+ ==DONE==
You can’t perform that action at this time.
0 commit comments