ghostscript/ghostscript-trio-g.patch
2014-08-15 10:57:29 +01:00

26 lines
976 B
Diff

diff -up ghostscript-9.14/trio/trio.c.trio-g ghostscript-9.14/trio/trio.c
--- ghostscript-9.14/trio/trio.c.trio-g 2014-03-26 12:53:48.000000000 +0000
+++ ghostscript-9.14/trio/trio.c 2014-08-15 10:10:39.714065073 +0100
@@ -3172,6 +3172,9 @@ TRIO_ARGS6((self, number, flags, width,
if (integerNumber > epsilon)
{
integerDigits += (int)TrioLogarithm(integerNumber, base);
+ /* Deal with the dangers of casting long double to int */
+ if (integerNumber - TrioPower (base, integerDigits) >= 0)
+ integerDigits++;
}
fractionDigits = precision;
@@ -3255,6 +3258,11 @@ TRIO_ARGS6((self, number, flags, width,
integerDigits = (integerNumber > epsilon)
? 1 + (int)TrioLogarithm(integerNumber, base)
: 1;
+
+ /* Deal with the dangers of casting long double to int */
+ if (integerNumber - TrioPower (base, integerDigits) >= 0)
+ integerDigits++;
+
if (flags & FLAGS_FLOAT_G)
{
if (flags & FLAGS_ALTERNATIVE)