[raster, smooth] Directly test outline size (#47500).

This improves stand-alone compilation.

* src/base/ftoutln.c (FT_Outline_Render): Move cbox size test to...

* src/raster/ftraster.c (ft_black_render), src/smooth/ftgrays.c
(gray_raster_render): ...these functions.
This commit is contained in:
Werner Lemberg 2016-03-23 07:31:59 +01:00
parent e9181aba2c
commit 31f2dc1946
4 changed files with 39 additions and 6 deletions

View File

@ -1,3 +1,14 @@
2016-03-23 Werner Lemberg <wl@gnu.org>
[raster, smooth] Directly test outline size (#47500).
This improves stand-alone compilation.
* src/base/ftoutln.c (FT_Outline_Render): Move cbox size test to...
* src/raster/ftraster.c (ft_black_render), src/smooth/ftgrays.c
(gray_raster_render): ...these functions.
2016-03-23 Werner Lemberg <wl@gnu.org>
[raster, smooth] Fix some clang sanitizer runtime issues.

View File

@ -618,7 +618,6 @@
FT_Error error;
FT_Renderer renderer;
FT_ListNode node;
FT_BBox cbox;
if ( !library )
@ -630,11 +629,6 @@
if ( !params )
return FT_THROW( Invalid_Argument );
FT_Outline_Get_CBox( outline, &cbox );
if ( cbox.xMin < -0x1000000L || cbox.yMin < -0x1000000L ||
cbox.xMax > 0x1000000L || cbox.yMax > 0x1000000L )
return FT_THROW( Invalid_Outline );
renderer = library->cur_renderer;
node = library->renderers.head;

View File

@ -3175,6 +3175,20 @@
if ( !target_map->buffer )
return FT_THROW( Invalid );
/* reject too large outline coordinates */
{
FT_Vector* vec = outline->points;
FT_Vector* limit = vec + outline->n_points;
for ( ; vec < limit; vec++ )
{
if ( vec->x < -0x1000000L || vec->x > 0x1000000L ||
vec->y < -0x1000000L || vec->y > 0x1000000L )
return FT_THROW( Invalid );
}
}
ras.outline = *outline;
ras.target = *target_map;

View File

@ -2074,6 +2074,20 @@ typedef ptrdiff_t FT_PtrDist;
if ( !( params->flags & FT_RASTER_FLAG_AA ) )
return FT_THROW( Invalid_Mode );
/* reject too large outline coordinates */
{
FT_Vector* vec = outline->points;
FT_Vector* limit = vec + outline->n_points;
for ( ; vec < limit; vec++ )
{
if ( vec->x < -0x1000000L || vec->x > 0x1000000L ||
vec->y < -0x1000000L || vec->y > 0x1000000L )
return FT_THROW( Invalid_Outline );
}
}
/* compute clipping box */
if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
{