Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d3acdf5

Browse files
committed
Fix GH-19730: imageaffine integer overflow on affine matrix.
1 parent 9d69ab9 commit d3acdf5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎ext/gd/libgd/gd_interpolation.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,10 +2461,17 @@ int gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPt
24612461
if (max.y < extent[i].y)
24622462
max.y=extent[i].y;
24632463
}
2464+
double twidth = floor(max.x - min.x) - 1;
2465+
double theight = floor(max.y - min.y);
2466+
2467+
if (twidth < (double)INT_MIN || twidth > (double)INT_MAX ||
2468+
theight < (double)INT_MIN || theight > (double)INT_MAX)
2469+
return GD_FALSE;
2470+
24642471
bbox->x = (int) min.x;
24652472
bbox->y = (int) min.y;
2466-
bbox->width = (int) floor(max.x-min.x) -1;
2467-
bbox->height = (int) floor(max.y-min.y);
2473+
bbox->width = (int) twidth;
2474+
bbox->height = (int) theight;
24682475
return GD_TRUE;
24692476
}
24702477

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /