Skip to content

Commit 59a4db5

Browse files
committed
Add extra check for srcW/H
1 parent 448e528 commit 59a4db5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

ext/gd/libgd/gd.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,6 @@ static int _gdValidateCopyRectBounds(
23422342
return 1;
23432343
}
23442344

2345-
23462345
void gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h)
23472346
{
23482347
if (!_gdValidateCopyRectBounds(dst, src, dstX, dstY, srcX, srcY, w, h)) {
@@ -2536,6 +2535,10 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
25362535
return;
25372536
}
25382537

2538+
if (!_gdValidateCopyRectBounds(dst, src, dstX, dstY, srcX, srcY, srcW, srcH)) {
2539+
return;
2540+
}
2541+
25392542
int c;
25402543
int x, y;
25412544
int tox, toy;
@@ -2650,6 +2653,10 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
26502653
return;
26512654
}
26522655

2656+
if (!_gdValidateCopyRectBounds(dst, src, dstX, dstY, srcX, srcY, srcW, srcH)) {
2657+
return;
2658+
}
2659+
26532660
int x, y;
26542661
double sy1, sy2, sx1, sx2;
26552662

0 commit comments

Comments
 (0)