Fix Savannah bug #27742. * src/base/ftstroke.c (ft_stroker_outside): Avoid silent division by zero, using a threshold for `theta'.
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
diff --git a/ChangeLog b/ChangeLog
index 4032df9..d8c78d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2009-11-20 Werner Lemberg <wl@gnu.org>
+ Fix Savannah bug #27742.
+
+ * src/base/ftstroke.c (ft_stroker_outside): Avoid silent division by
+ zero, using a threshold for `theta'.
+
+2009-11-20 Werner Lemberg <wl@gnu.org>
+
Fix Savannah bug #28036.
* src/type1/t1afm.c (t1_get_index): Fix comparison.
diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c
index 0978b0e..5005b1c 100644
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -979,7 +979,8 @@
thcos = FT_Cos( theta );
sigma = FT_MulFix( stroker->miter_limit, thcos );
- if ( sigma >= 0x10000L )
+ /* FT_Sin(x) = 0 for x <= 57 */
+ if ( sigma >= 0x10000L || ft_pos_abs( theta ) <= 57 )
miter = FALSE;
if ( miter ) /* this is a miter (broken angle) */
@@ -1360,7 +1361,7 @@
phi1 = (angle_mid + angle_in ) / 2;
phi2 = (angle_mid + angle_out ) / 2;
length1 = FT_DivFix( stroker->radius, FT_Cos( theta1 ) );
- length2 = FT_DivFix( stroker->radius, FT_Cos(theta2) );
+ length2 = FT_DivFix( stroker->radius, FT_Cos( theta2 ) );
for ( side = 0; side <= 1; side++ )
{