From 739f5614e67d282f92639af722fb5adf85a0f050 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Fri, 15 Aug 2014 10:13:03 +0100 Subject: [PATCH] Fix double-to-string conversion on e.g. ppc64 (bug #1014772). Resolves: rhbz#1014772 --- ghostscript-trio-g.patch | 25 +++++++++++++++++++++++++ ghostscript.spec | 9 ++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 ghostscript-trio-g.patch diff --git a/ghostscript-trio-g.patch b/ghostscript-trio-g.patch new file mode 100644 index 0000000..18247c2 --- /dev/null +++ b/ghostscript-trio-g.patch @@ -0,0 +1,25 @@ +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) diff --git a/ghostscript.spec b/ghostscript.spec index eb8bef7..68c087c 100644 --- a/ghostscript.spec +++ b/ghostscript.spec @@ -5,7 +5,7 @@ Summary: A PostScript interpreter and renderer Name: ghostscript Version: %{gs_ver} -Release: 3%{?dist} +Release: 4%{?dist} # Included CMap data is Redistributable, no modification permitted, # see http://bugzilla.redhat.com/487510 @@ -33,6 +33,7 @@ Patch9: ghostscript-wrf-snprintf.patch Patch10: ghostscript-gs694154.patch Patch11: ghostscript-sys-zlib.patch Patch12: ghostscript-crash.patch +Patch13: ghostscript-trio-g.patch Requires: urw-fonts >= 1.1, ghostscript-fonts Requires: poppler-data @@ -142,6 +143,9 @@ rm -rf expat freetype icclib jasper jpeg jpegxr lcms lcms2 libpng openjpeg zlib # Prevent memory handling crash. %patch12 -p1 -b .crash +# Fix double-to-string conversion on e.g. ppc64 (bug #1014772). +%patch13 -p1 -b .trio-g + # Convert manual pages to UTF-8 from8859_1() { iconv -f iso-8859-1 -t utf-8 < "$1" > "${1}_" @@ -333,6 +337,9 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/libgs.so %changelog +* Fri Aug 15 2014 Tim Waugh 9.14-4 +- Fix double-to-string conversion on e.g. ppc64 (bug #1014772). + * Wed Jun 4 2014 Tim Waugh 9.14-3 - Applied patch from upstream to fix memory handling issue that could lead to crashes (bug #1087071).