rpms/paps/FC-6 paps-0.6.6-fix-wcswidth.patch, NONE, 1.1 paps.spec, 1.18, 1.19

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Dec 4 11:48:56 UTC 2006


Author: tagoh

Update of /cvs/dist/rpms/paps/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv26826

Modified Files:
	paps.spec 
Added Files:
	paps-0.6.6-fix-wcswidth.patch 
Log Message:
* Mon Dec  4 2006 Akira TAGOH <tagoh at redhat.com> - 0.6.6-17
- Fix a segfault on non-printable character. (#216296)
- Resolves: rhbz#216296

paps-0.6.6-fix-wcswidth.patch:
 paps.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

--- NEW FILE paps-0.6.6-fix-wcswidth.patch ---
diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c
--- paps-0.6.6.orig/src/paps.c	2006-12-04 20:08:36.000000000 +0900
+++ paps-0.6.6/src/paps.c	2006-12-04 20:16:59.000000000 +0900
@@ -712,7 +712,7 @@
 	      PangoRectangle ink_rect, logical_rect;
 	      wchar_t *wtext, *wnewtext;
 	      gchar *newtext;
-	      size_t i, len, wwidth = 0, n;
+	      int i, len, wwidth = 0, n;
 
 	      wtext = (wchar_t *)g_utf8_to_ucs4 (para->text, para->length, NULL, NULL, NULL);
 	      if (wtext == NULL)
@@ -722,11 +722,17 @@
 		}
 
 	      len = wcswidth (wtext);
+	      if (len < 0)
+		{
+		  /* assuming that width of all characters in wtext may be 1 */
+		  len = wcslen (wtext);
+		}
 	      /* the amount of characters to be able to put on the line against CPI */
 	      n = page_layout->column_width / 72.0 * cpi;
 	      if (len > n)
 	        {
-		  wnewtext = g_new (wchar_t, wcslen (wtext) + 1);
+		  len = wcslen (wtext);
+		  wnewtext = g_new (wchar_t, len + 1);
 		  if (wnewtext == NULL)
 		    {
 		      fprintf (stderr, "Failed to allocate a memory.\n");
@@ -735,7 +741,14 @@
 		    }
 		  for (i = 0; i < len; i++)
 		    {
-		      wwidth += wcwidth (wtext[i]);
+		      int w = wcwidth (wtext[i]);
+
+		      if (w < 0)
+			{
+			  /* assuming that a width of this character may be 1 */
+			  w = 1;
+			}
+		      wwidth += w;
 		      if (wwidth > n)
 			  break;
 		      wnewtext[i] = wtext[i];


Index: paps.spec
===================================================================
RCS file: /cvs/dist/rpms/paps/FC-6/paps.spec,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- paps.spec	29 Sep 2006 18:18:36 -0000	1.18
+++ paps.spec	4 Dec 2006 11:48:54 -0000	1.19
@@ -1,6 +1,6 @@
 Name:		paps
 Version:	0.6.6
-Release:	16%{?dist}
+Release:	17%{?dist}
 
 License:	LGPL
 URL:		http://paps.sourceforge.net/
@@ -25,6 +25,7 @@
 ## fixed in CVS
 Patch9:		paps-0.6.6-cpilpi.patch
 Patch10:	paps-0.6.6-exitcode.patch
+Patch11:	paps-0.6.6-fix-wcswidth.patch
 Patch50:	paps-cups.patch
 
 Summary:	Plain Text to PostScript converter
@@ -45,6 +46,7 @@
 %patch8 -p1 -b .wordwrap
 %patch9 -p1 -b .cpilpi
 %patch10 -p1 -b .exitcode
+%patch11 -p1 -b .wcswidth
 %patch50 -p1 -b .cups
 aclocal
 automake
@@ -78,6 +80,9 @@
 
 
 %changelog
+* Mon Dec  4 2006 Akira TAGOH <tagoh at redhat.com> - 0.6.6-17
+- Fix a segfault on non-printable character. (#216296)
+
 * Sat Sep 30 2006 Akira TAGOH <tagoh at redhat.com> - 0.6.6-16
 - paps-0.6.6-exitcode.patch: exit immediately with proper exit code
   when unrecoverable error occurs. (#208592)




More information about the fedora-cvs-commits mailing list