php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39132 integer overflow in memory_limit with memory >= 2GB.
Submitted: 2006-10-12 03:17 UTC Modified: 2006-10-20 01:00 UTC
Votes:14
Avg. Score:4.5 ± 0.7
Reproduced:13 of 13 (100.0%)
Same Version:9 (69.2%)
Same OS:8 (61.5%)
From: php at vicaya dot com Assigned:
Status: No Feedback Package: Unknown/Other Function
PHP Version: 5.1.6 OS: Linux 64-bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at vicaya dot com
New email:
PHP Version: OS:

 

 [2006-10-12 03:17 UTC] php at vicaya dot com
Description:
------------
Looks like memory_limit is kept using a 32-bit signed integer even with php compiled on 64-bit Linux.

Reproduce code:
---------------
set memory_limit to -1 or >= 2048M

<?= count(file("a_big_file")) ?>

Expected result:
----------------
number of lines in "a_big_file".

Actual result:
--------------
"Integer overflow in memory_limit check detected"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-12 08:05 UTC] derick@php.net
Yes, it's using a size_t which AFAIK is limited to 32bit on most systems.
 [2006-10-12 09:57 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-10-20 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-01-27 13:55 UTC] vadim at vadiaz dot com
same behavior on 5.2.5
setting memory_limit to 4096M result in almost any script produce following error:

Allowed memory size of 
262144 bytes exhausted

262144 == 0x40000

I put 4000000000 in php.ini and it looks like it work now
so parsing '4096M' does produce memory_limit 4Gb
 [2016-01-25 14:08 UTC] mg at artigo dot pl
Same issue on 5.6.14 64 bit + Apache 64 bit + Windows 64 bit.
Can't set "4096M", getting:
PHP Fatal error:  Allowed memory size of 262144 bytes exhausted
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 04:01:28 2024 UTC