Skip to content

Commit 9028b37

Browse files
committed
Fix GH-19751: imagefill buffer overflow.
1 parent 93865a4 commit 9028b37

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/gd/libgd/gd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,6 +2043,12 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
20432043
FILL_PUSH(y+1, x, x, -1);
20442044
while (sp>stack) {
20452045
FILL_POP(y, x1, x2, dy);
2046+
if (y > im->sy) {
2047+
y = im->sy;
2048+
}
2049+
if (x > im->sx) {
2050+
x = im->sx;
2051+
}
20462052
for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) {
20472053
nc = gdImageTileGet(im,x,y);
20482054
pts[y][x] = 1;

0 commit comments

Comments
 (0)