Bug #67374 [NEW]: Integer Overflow in Memory Usage Functions

From: Date: Tue, 03 Jun 2014 14:42:38 +0000
Subject: Bug #67374 [NEW]: Integer Overflow in Memory Usage Functions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186033@lists.php.net to get a copy of this message
From: johannesdahse at gmx dot de Operating system: PHP version: 5.5.13 Package: PHP options/info functions Bug Type: Bug Bug description:Integer Overflow in Memory Usage Functions Description: ------------ The memory usage functions memory_get_usage() and memory_get_peak_usage() are limited by INTEGER and can only store the memory usage of 2.147 GB. This results in false reports for higher memory usage. Tested on Windows 7 64bit, PHP 5.5.13 (64bit and 32bit version). Test script: --------------- ini_set("memory_limit", "3G"); $a = array(); for($i=0; $i<22; $i++) $a[$i] = str_repeat("A", 100000000); echo memory_get_peak_usage(); Expected result: ---------------- 2200227928 Actual result: -------------- -2094739216 -- Edit bug report at https://bugs.php.net/bug.php?id=67374&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67374&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67374&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67374&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=67374&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=67374&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=67374&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=67374&r=needscript Try newer version: https://bugs.php.net/fix.php?id=67374&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=67374&r=support Expected behavior: https://bugs.php.net/fix.php?id=67374&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=67374&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=67374&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=67374&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67374&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=67374&r=dst IIS Stability: https://bugs.php.net/fix.php?id=67374&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=67374&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=67374&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=67374&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=67374&r=mysqlcfg

« previous php.bugs (#186033) next »