diff --git a/src/share/native/sun/awt/medialib/mlib_ImageScanPoly.c b/src/share/native/sun/awt/medialib/mlib_ImageScanPoly.c index ccc15728004912758c6ff487b03ef9e38756c147..41f5cfc96e9f2a2f6a6e66d88cd6de9aa1c80b02 100644 --- a/src/share/native/sun/awt/medialib/mlib_ImageScanPoly.c +++ b/src/share/native/sun/awt/medialib/mlib_ImageScanPoly.c @@ -424,7 +424,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if ((dxs < dxCl) || (dxs >= dwCl) || (dys < dyCl) || (dys >= dhCl)) { dxs += dx; dys += dy; - xLeft++; + if (xLeft < MLIB_S32_MAX) { + xLeft++; + } if ((dxs < dxCl) || (dxs >= dwCl) || (dys < dyCl) || (dys >= dhCl)) xRight = -1; @@ -436,7 +438,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if ((dxe < dxCl) || (dxe >= dwCl) || (dye < dyCl) || (dye >= dhCl)) { dxe -= dx; dye -= dy; - xRight--; + if (xRight > MLIB_S32_MIN) { + xRight--; + } if ((dxe < dxCl) || (dxe >= dwCl) || (dye < dyCl) || (dye >= dhCl)) xRight = -1; @@ -510,7 +514,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if ((dxs > dxCl) || (dxs <= dwCl) || (dys > dyCl) || (dys <= dhCl)) { dxs += dx; dys += dy; - xLeft++; + if (xLeft < MLIB_S32_MAX) { + xLeft++; + } if ((dxs > dxCl) || (dxs <= dwCl) || (dys > dyCl) || (dys <= dhCl)) xRight = -1; @@ -522,7 +528,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if ((dxe > dxCl) || (dxe <= dwCl) || (dye > dyCl) || (dye <= dhCl)) { dxe -= dx; dye -= dy; - xRight--; + if (xRight > MLIB_S32_MIN) { + xRight--; + } if ((dxe > dxCl) || (dxe <= dwCl) || (dye > dyCl) || (dye <= dhCl)) xRight = -1;