Bug #71882 [NEW]: Negative ftruncate() on php://memory exhausts memory
From: miloslav dot hula at gmail dot com
Operating system:
PHP version: Irrelevant
Package: Streams related
Bug Type: Bug
Bug description:Negative ftruncate() on php://memory exhausts memory
Description:
------------
Calling ftruncate() with negative index on php://memory leads to memory
exhaustion and fatal error.
https://3v4l.org/k720s
Test script:
---------------
<?php
$fd = fopen("php://memory", "w+");
ftruncate($fd, -1);
Expected result:
----------------
(nothing)
Actual result:
--------------
Fatal error: Out of memory (allocated 2097152) (tried to allocate
18446744073709551615 bytes) in /in/k720s on line 4
mmap() failed: [22] Invalid argument
mmap() failed: [22] Invalid argument
Process exited with code 255.
--
Edit bug report at https://bugs.php.net/bug.php?id=71882&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71882&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71882&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71882&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71882&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71882&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71882&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71882&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71882&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71882&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71882&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71882&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71882&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71882&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71882&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71882&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71882&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71882&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71882&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71882&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71882&r=mysqlcfg
Thread (5 messages)
- miloslav dot hula at gmail dot com