Skip to content
Draft

Gh19730 #19732

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ext/gd/libgd/gd_interpolation.c
Original file line number Diff line number Diff line change
Expand Up @@ -2461,10 +2461,18 @@ int gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPt
if (max.y < extent[i].y)
max.y=extent[i].y;
}
double twidth = floor(max.x - min.x) - 1;
double theight = floor(max.y - min.y);

if (twidth < (double)INT_MIN || twidth > (double)INT_MAX)
twidth = 0.0;
if (theight < (double)INT_MIN || theight > (double)INT_MAX)
theight = 0.0;

bbox->x = (int) min.x;
bbox->y = (int) min.y;
bbox->width = (int) floor(max.x - min.x) - 1;
bbox->height = (int) floor(max.y - min.y);
bbox->width = (int) twidth;
bbox->height = (int) theight;
return GD_TRUE;
}

Expand Down