bug-unrtf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-unrtf] Fwd: Improvements to GNU UnRTF


From: Gero Herrmann
Subject: [bug-unrtf] Fwd: Improvements to GNU UnRTF
Date: Sun, 14 Sep 2014 21:43:49 +0200

Begin forwarded message:

差出人: Gero Herrmann <address@hidden>
日時: 11. September 2014 02:11:17 MESZ
件名: Improvements to GNU UnRTF

Dear maintainer of GNU UnRTF,

I am sending you files "attr.c" and "convert.c", which contain fixes to GNU UnRTF.


Attachment: changedfiles.zip
Description: Zip archive




1. Changes to "attr.c"

In function "attrstack_drop", I replaced "if (prev_stack)" by "if (prev_stack->next)". This probably was intended by the author anyhow because at present the "if" condition is always fulfilled. The replacement fixes a fatal bug, which caused a segmentation fault crash on some systems.

(Concretely, I confirmed the crash on two PowerPC systems under Mac OS X 10.4.11. To describe the problem in detail, in a situation where the stack of stacks contains exactly one AttrStack, both stack_of_stack and stack_of_stack_top point to the one AttrStack. If function "attrstack_drop" is then called, prev_stack is assigned the value of stack_of_stacks. Because that value points to the one AttrStack, prev_stack is not NULL, such that the while condition in line 571 will be false and the if condition in line 574 will be true. After the assignments in lines 575 and 576, which do not change anything, the memory of the one AttrStack is freed with both stack_of_stack and stack_of_stack_top left pointing to it. The particular crash I observed happened in line 355 when function attr_get_param attempted to access a field of the one AttrStack still pointed to by stack_of_stacks_top.)

Besides, I deleted two lines relating to variable prev_stack in function attrstack_push because this variable is never used.


2. Changes to "convert.c"

I rewrote function "cmd_ulnone" because this function tested for all different kinds of underline attributes but removed only the plain kind (ATTR_UNDERLINE). This caused an infinite loop whenever an RTF input contained other kinds of underlines followed by \ulnone.

I also entered the German month names which had been only placeholders. Moreover, I entered "SJIS" for Mac Japanese because this encoding is practically identical to Shift-JIS.

Yours, faithfully
Gero Herrmann
Munich, Germany


reply via email to

[Prev in Thread] Current Thread [Next in Thread]