php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66488 32-bit integers used internally
Submitted: 2014-01-15 15:02 UTC Modified: 2017-01-22 00:03 UTC
Votes:4
Avg. Score:4.8 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: scott at arciszewski dot me Assigned:
Status: Suspended Package: GD related
PHP Version: 5.5.8 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-01-15 15:02 UTC] scott at arciszewski dot me
Description:
------------
Even when using PHP with GD on a 64-bit machine, the 4 GB memory limit rears its ugly head.

Thus, we have problems like this one:
https://stackoverflow.com/questions/20614686/gd-warning-product-of-memory-allocation-multiplication-would-exceed-int-max

I would propose going in and updating the integer definitions to accommodate 64-bit processors and its larger memory space, but GD isn't my forte so I'm not sure if I would break all of the things if I went in and patched it.

Test script:
---------------
echo PHP_INT_MAX . '<br/>';
echo 174400 * 249600 . '<br/>';
$img = imagecreatetruecolor(174400, 249600);

Expected result:
----------------
9223372036854775807
43530240000
Warning: imagecreatetruecolor(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in /home/bartek/Documents/WWW/WOF/application/controllers/EditorController.php on line 5

Actual result:
--------------
<b>Parse error</b>:  imagecreatetruecolor(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-22 00:03 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2017-01-22 00:03 UTC] cmb@php.net
That is something that should be resolved for libgd generally, not
only for our bundled libgd, so I'm suspending this ticket as
there's already a respective one for libgd, see
<https://github.com/libgd/libgd/issues/122>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 14:01:29 2024 UTC