* src/base/ftobjs.c (FT_Request_Metrics): Avoid division by zero.

The division-by-zero might happen in broken fonts (see #1194).
Instead of returning a huge number from FT_DivFix until and failing
to scale later, we now bail immediately.
This commit is contained in:
Alexei Podtelezhnikov 2023-01-03 20:41:42 +00:00
parent 0bcb664de8
commit e66480b56f
1 changed files with 8 additions and 0 deletions

View File

@ -3276,6 +3276,14 @@
if ( h < 0 )
h = -h;
if ( ( !w && req->width ) ||
( !h && ( req->height || !req->width ) ) )
{
FT_ERROR(( "FT_Request_Metrics: Divide by zero\n" ));
error = FT_ERR( Divide_By_Zero );
goto Exit;
}
scaled_w = FT_REQUEST_WIDTH ( req );
scaled_h = FT_REQUEST_HEIGHT( req );