[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
diff --git a/ChangeLog b/ChangeLog
index 2a8c04b..ee6220b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
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.
* src/raster/ftraster.c (ft_black_reset, ft_black_set_mode,
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index 1cf8644..fa2d2cf 100644
--- 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 )
@@ -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;
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 2972553..01ed1c5 100644
--- 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;
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 2d548de..9b008a0 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -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 ) )
{