php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51498 imagefilledellipse does not work for large circles
Submitted: 2010-04-07 17:02 UTC Modified: 2021-07-30 22:07 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:1 (25.0%)
From: thomas dot sahlin at invented dot se Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: 5.6.10 OS: 32bit,LLP64
Private report: No CVE-ID: None
 [2010-04-07 17:02 UTC] thomas dot sahlin at invented dot se
Description:
------------
When drawing really large circles (diameter >= 2100) using imagefilledellipse, the circles get distorted.

Test script:
---------------
$img = imagecreatetruecolor(2200, 2200);
$white = imagecolorallocate($img, 255, 255, 255);
imagefilledellipse($img, 1100, 1100, 2200, 2200, $white);
imagepng($img, '/tmp/test.png');
imagedestroy($img);


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-10 22:48 UTC] matthew at dps dot uk dot com
Same issues with imagearc
 [2015-06-28 18:41 UTC] cmb@php.net
-Status: Open +Status: Suspended -Operating System: Ubuntu +Operating System: 32bit,LLP64 -PHP Version: 5.2.13 +PHP Version: 5.6.10 -Assigned To: +Assigned To: cmb
 [2015-06-28 18:41 UTC] cmb@php.net
This happens also for imageellipse(). The code[1] shows, that
it is an integer overflow issue in libgd. Consider w = h = 2200.
Then

a = 1100
b = 1100
aq = 1210000
bq = 1210000
dx = 2420000
dy = 2420000
r = 1331000000
rx = 2662000000

The value of rx doesn't really fit in a signed 32bit variable.
However, long is 32bit on 32bit architectures and on LLP64 (e.g.
Windows). Therefore the supplied test script fails on these
architectures, but works on most 64bit Unix-like systems.

I have reported the issue upstream[2] and suspend this ticket
until the problem is resolved in libgd.

[1] <http://lxr.php.net/xref/PHP_TRUNK/ext/gd/libgd/gd_arc.c#17>
[2] <https://github.com/libgd/libgd/issues/169>
 [2017-08-16 16:28 UTC] cmb@php.net
-Assigned To: cmb +Assigned To:
 [2021-07-30 22:07 UTC] cmb@php.net
-Status: Suspended +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-07-30 22:07 UTC] cmb@php.net
The bug has been fixed upstream; I'll backport the fix.
 [2021-08-02 09:07 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #51498: imagefilledellipse does not work for large circles
On GitHub:  https://github.com/php/php-src/pull/7329
Patch:      https://github.com/php/php-src/pull/7329.patch
 [2021-08-03 14:23 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/php-src/commit/c565555f0372124ac62b7923038d689c69d9a0fe
Log: Fix #51498: imagefilledellipse does not work for large circles
 [2021-08-03 14:23 UTC] git@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 15:01:28 2024 UTC