[Bug] Rtf2Text hangs [sf#14]
Closed this issue · 4 comments
Reported by edmondm on 2006-08-30 18:16 UTC
The linux version of the command hangs, it's because in
RtfReader.cpp, there is some code that checks for the
level of the open bracket { and close bracket }.
The method is commandIgnoreDestinationKeyword.
It is possible that in an RTF page, that the opening
bracket is present, but not the closing bracket. So we
added code that checks for the character to be a new
line \n, if it is, decrement the level. This assumes
that the closing bracket has been supplied and the
paragraph is complete. Word accepts the RTF page as
valid, and this routine as-is, was hung.
Commented by edmondm on 2006-08-30 18:52 UTC
Logged In: YES
user_id=1562102
I forgot to add that this code is very buggy. We also added
a check in that method to check the eof condition. Shame on
the developer that put this in a loop, without doing check,
so we run into these issues.
Add code
for (level=1; level!=0;)
{
if (stream->eof()) break; //add this line!!!
character = stream->get();
....
Commented by andrewpunch on 2006-10-15 13:34 UTC
Logged In: YES
user_id=928005
No longer hangs.
The RTF standard does not seem to specify that a newline
should be treated as a new paragraph. Although any behaviour
of Word should be considered acceptable.
Updated by andrewpunch on 2006-10-15 13:34 UTC
- assigned_to: nobody --> andrewpunch
Updated by andrewpunch on 2006-11-11 23:16 UTC
- status: open --> closed