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