Bug #51498 [Opn->Sus]: imagefilledellipse does not work for large circles

From: Date: Sun, 28 Jun 2015 18:41:26 +0000
Subject: Bug #51498 [Opn->Sus]: imagefilledellipse does not work for large circles
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193971@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=51498&edit=1

 ID:                 51498
 Updated by:         cmb@php.net
 Reported by:        thomas dot sahlin at invented dot se
 Summary:            imagefilledellipse does not work for large circles
-Status:             Open
+Status:             Suspended
 Type:               Bug
 Package:            GD related
-Operating System:   Ubuntu
+Operating System:   32bit,LLP64
-PHP Version:        5.2.13
+PHP Version:        5.6.10
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

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>


Previous Comments:
------------------------------------------------------------------------
[2011-06-10 22:48:51] matthew at dps dot uk dot com

Same issues with imagearc

------------------------------------------------------------------------
[2010-04-07 17:02:48] 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);



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=51498&edit=1


Thread (6 messages)

« previous php.bugs (#193971) next »