[autofit] Prevent signed integer overflow.

Reported as

  https://issues.oss-fuzz.com/issues/473887994
  https://issues.oss-fuzz.com/issues/473912282

* src/autofit/afatin.c (af_latin_align_top_tilde,
  af_latin_align_bottom_tilde), src/autofit/afloader.c
  (af_loader_load_glyph): Use `FT_PIX_ROUND_LONG`, `FT_PIX_CEIL_LONG`, and
  `SUB_LONG`.
This commit is contained in:
Werner Lemberg 2026-01-07 07:19:07 +01:00
parent 5f524d04b4
commit b91f75bd02
2 changed files with 6 additions and 6 deletions

View file

@ -3468,7 +3468,7 @@
} while ( p != first_point );
/* Align bottom of the tilde to the grid. */
min_y_rounded = FT_PIX_ROUND( min_y );
min_y_rounded = FT_PIX_ROUND_LONG( min_y );
delta = SUB_LONG( min_y_rounded, min_y );
height = SUB_LONG( max_y, min_y );
@ -3508,7 +3508,7 @@
} while ( p != first_point );
max_y_rounded = FT_PIX_ROUND( max_y );
max_y_rounded = FT_PIX_ROUND_LONG( max_y );
delta = SUB_LONG( max_y_rounded, max_y );
height = SUB_LONG( max_y, min_y );

View file

@ -524,11 +524,11 @@
bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
bbox.xMax = FT_PIX_CEIL( bbox.xMax );
bbox.yMax = FT_PIX_CEIL( bbox.yMax );
bbox.xMax = FT_PIX_CEIL_LONG( bbox.xMax );
bbox.yMax = FT_PIX_CEIL_LONG( bbox.yMax );
slot->metrics.width = bbox.xMax - bbox.xMin;
slot->metrics.height = bbox.yMax - bbox.yMin;
slot->metrics.width = SUB_LONG( bbox.xMax, bbox.xMin );
slot->metrics.height = SUB_LONG( bbox.yMax, bbox.yMin );
slot->metrics.horiBearingX = bbox.xMin;
slot->metrics.horiBearingY = bbox.yMax;