mirror of
https://gitlab.freedesktop.org/freetype/freetype.git
synced 2026-05-01 16:17:58 +02:00
* src/base/ftbitmap.c (FT_Bitmap_Blend): Use FT_ALLOC_MULT.
This call is fortified with builtin overflow checks.
This commit is contained in:
parent
dd66971f3c
commit
c111f0713c
1 changed files with 2 additions and 16 deletions
|
|
@ -922,14 +922,7 @@
|
|||
target->pitch = (int)final_width * 4;
|
||||
target->num_grays = 256;
|
||||
|
||||
if ( FT_LONG_MAX / target->pitch < (int)target->rows )
|
||||
{
|
||||
FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%u x %u)\n",
|
||||
final_width, final_rows ));
|
||||
return FT_THROW( Invalid_Argument );
|
||||
}
|
||||
|
||||
if ( FT_ALLOC( target->buffer, target->pitch * (int)target->rows ) )
|
||||
if ( FT_ALLOC_MULT( target->buffer, target->rows, target->pitch ) )
|
||||
return error;
|
||||
|
||||
free_target_bitmap_on_error = 1;
|
||||
|
|
@ -950,16 +943,9 @@
|
|||
|
||||
new_pitch = (int)final_width * 4;
|
||||
|
||||
if ( FT_LONG_MAX / new_pitch < (int)final_rows )
|
||||
{
|
||||
FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%u x %u)\n",
|
||||
final_width, final_rows ));
|
||||
return FT_THROW( Invalid_Argument );
|
||||
}
|
||||
|
||||
/* TODO: provide an in-buffer solution for large bitmaps */
|
||||
/* to avoid allocation of a new buffer */
|
||||
if ( FT_ALLOC( buffer, new_pitch * (int)final_rows ) )
|
||||
if ( FT_ALLOC_MULT( buffer, final_rows, new_pitch ) )
|
||||
goto Error;
|
||||
|
||||
/* copy data to new buffer */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue