From a5e9dbd528328fa62432326a1633e2f3d62194f8 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 20 Nov 2009 09:33:57 +0100 Subject: [PATCH] Fix Savannah bug #27742. * src/base/ftstroke.c (ft_stroker_outside): Avoid silent division by zero, using a threshold for `theta'. --- ChangeLog | 7 +++++++ src/base/ftstroke.c | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4032df920..d8c78d44e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-11-20 Werner Lemberg + + 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 Fix Savannah bug #28036. diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index 0978b0ed9..5005b1c6a 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++ ) {