[Glyph] Protect against an underflow

This commit is contained in:
Behdad Esfahbod committed 2023-04-30 11:31:46 -06:00
1 parent c7721f7df5
commit 1cbb85dc84
1 file changed
+10 -10
+10 -10
View File
@@ -155,17 +155,17 @@ struct Glyph
{
xMin = xMax = all_points[0].x;
yMin = yMax = all_points[0].y;
}
unsigned count = all_points.length - 4;
for (unsigned i = 1; i < count; i++)
{
float x = all_points[i].x;
float y = all_points[i].y;
xMin = hb_min (xMin, x);
xMax = hb_max (xMax, x);
yMin = hb_min (yMin, y);
yMax = hb_max (yMax, y);
unsigned count = all_points.length - 4;
for (unsigned i = 1; i < count; i++)
{
float x = all_points[i].x;
float y = all_points[i].y;
xMin = hb_min (xMin, x);
xMax = hb_max (xMax, x);
yMin = hb_min (yMin, y);
yMax = hb_max (yMax, y);
}
}
int rounded_xMin = roundf (xMin);