teambob / docfrac

DocFrac is a document converter that can convert between RTF, HTML and ASCII text. This includes RTF to HTML and HTML to RTF. Supports text formatting (e.g. bold); tables; and most European languages. Available for Windows; Linux; ActiveX and DLL.
GNU General Public License v2.0
13 stars 6 forks source link

[Bug] Rtf2Text hangs [sf#14] #36

Closed teambob closed 9 years ago

teambob commented 9 years ago

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.

teambob commented 9 years ago

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();

....

teambob commented 9 years ago

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.

teambob commented 9 years ago

Updated by andrewpunch on 2006-10-15 13:34 UTC

teambob commented 9 years ago

Updated by andrewpunch on 2006-11-11 23:16 UTC