Skip to content

Commit 0c9a741

Browse files
committed
Fix GH-19739: imagefilledellipse/imageellipse overflow
1 parent ebbed48 commit 0c9a741

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ext/gd/libgd/gd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,9 @@ void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c)
17301730
bq = b * b;
17311731
dx = aq << 1;
17321732
dy = bq << 1;
1733+
if (bq > 0 && a > INT64_MAX / bq) {
1734+
return;
1735+
}
17331736
r = a * bq;
17341737
rx = r << 1;
17351738
ry = 0;
@@ -1774,6 +1777,9 @@ void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
17741777
bq = b * b;
17751778
dx = aq << 1;
17761779
dy = bq << 1;
1780+
if (bq > 0 && a > INT64_MAX / bq) {
1781+
return;
1782+
}
17771783
r = a * bq;
17781784
rx = r << 1;
17791785
ry = 0;

0 commit comments

Comments
 (0)