|  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
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
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.
Bug Type:
From: thomas dot sahlin at invented dot se
New email:
PHP Version: OS:


 [2010-04-07 17:02 UTC] thomas dot sahlin at invented dot se
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');


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


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]
-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]
This happens also for imageellipse(). The code[1] shows, that
it is an integer overflow issue in libgd. Consider w = h = 2200.

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] <>
[2] <>
 [2017-08-16 16:28 UTC]
-Assigned To: cmb +Assigned To:
 [2021-07-30 22:07 UTC]
-Status: Suspended +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-07-30 22:07 UTC]
The bug has been fixed upstream; I'll backport the fix.
 [2021-08-02 09:07 UTC]
The following pull request has been associated:

Patch Name: Fix #51498: imagefilledellipse does not work for large circles
On GitHub:
 [2021-08-03 14:23 UTC]
Automatic comment on behalf of cmb69
Log: Fix #51498: imagefilledellipse does not work for large circles
 [2021-08-03 14:23 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 17:01:29 2024 UTC