- Fix the infinite loop in splitting paragraphs (#618483)

This commit is contained in:
Akira TAGOH 2010-07-27 03:40:55 +00:00
parent 42a36f5857
commit bd0b84e12d
2 changed files with 62 additions and 26 deletions

View File

@ -0,0 +1,31 @@
From 6c3fa9959dd454938378ade2fec8e84cee7d6916 Mon Sep 17 00:00:00 2001
From: Akira TAGOH <tagoh@redhat.com>
Date: Tue, 27 Jul 2010 12:19:30 +0900
Subject: [PATCH 1/2] Fix rhbz#618483: texttopaps becoms runaway memory hog
* src/paps.c (split_text_into_paragraphs): fix a infinite loop
when non-printable characters are in the text.
---
src/paps.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
* paps.c: Erased --justify option since it is not implemented in
diff --git a/src/paps.c b/src/paps.c
index 72dbaad..dcef349 100644
--- a/src/paps.c
+++ b/src/paps.c
@@ -835,7 +835,10 @@ split_text_into_paragraphs (PangoContext *pango_context,
goto fail;
}
for (i = 0; i < len; i++) {
- wwidth += wcwidth(wtext[i]);
+ gssize w = wcwidth(wtext[i]);
+
+ if (w >= 0)
+ wwidth += w;
if (wwidth > col)
break;
wnewtext[i] = wtext[i];
--
1.7.1.1

View File

@ -1,6 +1,6 @@
Name: paps Name: paps
Version: 0.6.8 Version: 0.6.8
Release: 13%{?dist} Release: 14%{?dist}
License: LGPLv2+ License: LGPLv2+
URL: http://paps.sourceforge.net/ URL: http://paps.sourceforge.net/
@ -23,6 +23,7 @@ Patch51: paps-cpilpi.patch
Patch52: paps-dsc-compliant.patch Patch52: paps-dsc-compliant.patch
Patch53: paps-autoconf262.patch Patch53: paps-autoconf262.patch
Patch54: paps-fix-cpi.patch Patch54: paps-fix-cpi.patch
Patch55: paps-fix-loop-in-split.patch
Summary: Plain Text to PostScript converter Summary: Plain Text to PostScript converter
Group: Applications/Publishing Group: Applications/Publishing
@ -59,6 +60,7 @@ applications using paps API.
%patch52 -p1 -b .dsc %patch52 -p1 -b .dsc
%patch53 -p1 -b .autoconf262 %patch53 -p1 -b .autoconf262
%patch54 -p1 -b .fixcpi %patch54 -p1 -b .fixcpi
%patch55 -p1 -b .loop
libtoolize -f -c libtoolize -f -c
autoreconf autoreconf
@ -106,6 +108,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libpaps.so %{_libdir}/libpaps.so
%changelog %changelog
* Tue Jul 27 2010 Akira TAGOH <tagoh@redhat.com> - 0.6.8-14
- Fix the infinite loop in splitting paragraphs (#618483)
* Fri Mar 12 2010 Akira TAGOH <tagoh@redhat.com> - 0.6.8-13 * Fri Mar 12 2010 Akira TAGOH <tagoh@redhat.com> - 0.6.8-13
- Fix the directory's group ownership. (#572733) - Fix the directory's group ownership. (#572733)