Fix #51498: imagefilledellipse does not work for large circles

We backport the respective upstream fix[1].

[1] <ace7fd88dc>

Closes GH-7329.
This commit is contained in:
Christoph M. Becker 2021-08-02 11:05:57 +02:00
parent d1ccb5bd0c
commit c565555f03
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
4 changed files with 25 additions and 2 deletions

3
NEWS
View file

@ -15,6 +15,9 @@ PHP NEWS
- CGI: - CGI:
. Fixed bug #80849 (HTTP Status header truncation). (cmb) . Fixed bug #80849 (HTTP Status header truncation). (cmb)
- GD:
. Fixed bug #51498 (imagefilledellipse does not work for large circles). (cmb)
- PDO_ODBC: - PDO_ODBC:
. Fixed bug #81252 (PDO_ODBC doesn't account for SQL_NO_TOTAL). (cmb) . Fixed bug #81252 (PDO_ODBC doesn't account for SQL_NO_TOTAL). (cmb)

View file

@ -1715,7 +1715,7 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c) void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c)
{ {
int x=0,mx1=0,mx2=0,my1=0,my2=0; int x=0,mx1=0,mx2=0,my1=0,my2=0;
long aq,bq,dx,dy,r,rx,ry,a,b; int64_t aq,bq,dx,dy,r,rx,ry,a,b;
a=w>>1; a=w>>1;
b=h>>1; b=h>>1;
@ -1754,7 +1754,7 @@ void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c)
void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c) void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
{ {
int x=0,mx1=0,mx2=0,my1=0,my2=0; int x=0,mx1=0,mx2=0,my1=0,my2=0;
long aq,bq,dx,dy,r,rx,ry,a,b; int64_t aq,bq,dx,dy,r,rx,ry,a,b;
int i; int i;
int old_y2; int old_y2;

View file

@ -0,0 +1,20 @@
--TEST--
Bug #51498 (imagefilledellipse does not work for large circles)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available");
if (!GD_BUNDLED && version_compare(GD_VERSION, "2.3.0") < 0) {
die("skip test requires GD 2.3.0 or higher");
}
?>
--FILE--
<?php
$img = imagecreatetruecolor(2200, 2200);
$white = imagecolorallocate($img, 255, 255, 255);
imagefilledellipse($img, 1100, 1100, 2200, 2200, $white);
require_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/bug51498_exp.png', $img);
?>
--EXPECT--
The images are equal.

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB