- Fix a segfault on non-printable character. (#216296)
This commit is contained in:
parent
158e47ea2b
commit
a055aa27e2
47
paps-0.6.6-fix-wcswidth.patch
Normal file
47
paps-0.6.6-fix-wcswidth.patch
Normal file
@ -0,0 +1,47 @@
|
||||
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];
|
@ -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 @@ Patch8: paps-0.6.6-wordwrap.patch
|
||||
## 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 @@ paps is a PostScript converter from plain text file using Pango.
|
||||
%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 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Dec 4 2006 Akira TAGOH <tagoh@redhat.com> - 0.6.6-17
|
||||
- Fix a segfault on non-printable character. (#216296)
|
||||
|
||||
* Sat Sep 30 2006 Akira TAGOH <tagoh@redhat.com> - 0.6.6-16
|
||||
- paps-0.6.6-exitcode.patch: exit immediately with proper exit code
|
||||
when unrecoverable error occurs. (#208592)
|
||||
|
Loading…
Reference in New Issue
Block a user