Commit bc12d9e9ac7c4960ad4539a48b261193a06fad88

Alexei Podtelezhnikov 2014-09-08T21:27:43

Fix Savannah bug #43153. * src/psaux/psconv.c (PS_Conv_ToFixed): Add protection against overflow in `divider'.

diff --git a/ChangeLog b/ChangeLog
index 77b2bc7..2dc6f6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-09-08  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	Fix Savannah bug #43153.
+
+	* src/psaux/psconv.c (PS_Conv_ToFixed): Add protection against
+	overflow in `divider'. 
+
 2014-09-03  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	[base] Tighten the overflow check in `FT_DivFix'.
diff --git a/src/psaux/psconv.c b/src/psaux/psconv.c
index d0d8861..7792a62 100644
--- a/src/psaux/psconv.c
+++ b/src/psaux/psconv.c
@@ -250,7 +250,8 @@
         if ( c < 0 || c >= 10 )
           break;
 
-        if ( decimal < 0xCCCCCCCL )
+        /* only add digit if we don't overflow */
+        if ( divider < 0xCCCCCCCL && decimal < 0xCCCCCCCL )
         {
           decimal = decimal * 10 + c;