[autofit] Prevent signed integer overflow.

Reported as

  https://issues.oss-fuzz.com/issues/471525116

* src/autofit/aflatin.c (af_latin_stretch_top_tilde,
  af_latin_stretch_bottom_tilde): Use `MUL_LONG`.
This commit is contained in:
Werner Lemberg
2026-01-04 07:28:04 +01:00
parent 914b474030
commit 7b72c0f238

View File

@@ -3309,12 +3309,14 @@
p = first_point;
do
{
p = p->next;
/* We adjust the height of the diacritic only, which means */
/* we are never dealing with large numbers and can thus avoid */
/* `FT_MulFix`. */
p->y = ADD_LONG( SUB_LONG( p->y, min_y ) * target_height / height,
min_y );
p = p->next;
/* We adjust the height of the diacritic only, which means */
/* we are never dealing with (valid) large numbers and can */
/* thus avoid `FT_MulFix`. */
p->y = ADD_LONG( MUL_LONG( SUB_LONG( p->y,
min_y ),
target_height ) / height,
min_y );
} while ( p != first_point );
@@ -3404,9 +3406,11 @@
p = first_point;
do
{
p = p->next;
p->y = ADD_LONG( SUB_LONG( p->y, max_y ) * target_height / height,
max_y );
p = p->next;
p->y = ADD_LONG( MUL_LONG( SUB_LONG( p->y,
max_y ),
target_height ) / height,
max_y );
} while ( p != first_point );