From ef070d458bfe965116a36734dfc6b639644c6855 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 15 Sep 2014 22:06:19 -0400 Subject: [PATCH] [base] Tighten the overflow check in `FT_MulDiv'. * src/base/ftcalc.c (FT_MulDiv) [!FT_LONG64]: Updated. --- ChangeLog | 6 ++++++ src/base/ftcalc.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2dc6f6e8e..1a2df15fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-09-08 Alexei Podtelezhnikov + + [base] Tighten the overflow check in `FT_MulDiv'. + + * src/base/ftcalc.c (FT_MulDiv) [!FT_LONG64]: Updated. + 2014-09-08 Alexei Podtelezhnikov Fix Savannah bug #43153. diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 723712ead..c333b9b36 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -385,7 +385,7 @@ /* */ /* or, alternatively, */ /* */ - /* a + b <= 129895 - (c >> 17) . */ + /* a + b <= 129894 - (c >> 17) . */ /* */ /* FT_MulFix, on the other hand, is optimized for a small value of */ /* the first argument, when the second argument can be much larger. */ @@ -426,7 +426,7 @@ if ( c == 0 ) a = 0x7FFFFFFFL; - else if ( (FT_ULong)a + b <= 129895UL - ( c >> 17 ) ) + else if ( (FT_ULong)a + b <= 129894UL - ( c >> 17 ) ) a = ( (FT_ULong)a * b + ( c >> 1 ) ) / c; else