shithub: freetype+ttf2subf

Download patch

ref: 31f2dc19462774dd4e5b55f80cafcee07077e744
parent: e9181aba2c5594f5fedba649170c6e8efbabdea2
author: Werner Lemberg <[email protected]>
date: Wed Mar 23 03:31:59 EDT 2016

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2016-03-23  Werner Lemberg  <[email protected]>
 
+	[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  <[email protected]>
+
 	[raster, smooth] Fix some clang sanitizer runtime issues.
 
 	* src/raster/ftraster.c (ft_black_reset, ft_black_set_mode,
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -618,7 +618,6 @@
     FT_Error     error;
     FT_Renderer  renderer;
     FT_ListNode  node;
-    FT_BBox      cbox;
 
 
     if ( !library )
@@ -629,11 +628,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;
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -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;
 
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -2074,6 +2074,20 @@
     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 ) )
     {