[base] Tighten the overflow check in `FT_MulDiv'. * src/base/ftcalc.c (FT_MulDiv) [!FT_LONG64]: Updated.
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
diff --git a/ChangeLog b/ChangeLog
index 2dc6f6e..1a2df15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2014-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
+ [base] Tighten the overflow check in `FT_MulDiv'.
+
+ * src/base/ftcalc.c (FT_MulDiv) [!FT_LONG64]: Updated.
+
+2014-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
+
Fix Savannah bug #43153.
* src/psaux/psconv.c (PS_Conv_ToFixed): Add protection against
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 723712e..c333b9b 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