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] Rtf to Text conversion crashed Linux command [sf#13] #35

Closed teambob closed 9 years ago

teambob commented 9 years ago

Reported by edmondm on 2006-07-27 00:50 UTC Trying to run the code, was able to open the rtf document in word. But when run the linux command line, --from-rtf <filename.rtf> --to-text <filename.txt> I get segmentation fault. I tried other rtf documents, and it worked.

So I took a look at the text of the rtf document, turns out that the document didn't have matching starting { and ending }.

The code in RtfReader.cpp, does a pop of the stack. This would take a segmentation fault, if the stack is empty. I thought this would not be a valid rtf document, but apparently word doesn't care, so it is.

So I changed RtfReader.cpp to check

case '}':

if (! rtfStack->empty() ) {

//rest of the code

And that seemed to work.

teambob commented 9 years ago

Commented by andrewpunch on 2006-10-15 13:36 UTC Logged In: YES user_id=928005

Problem fixed for 3.1.2. Checks if stack is empty before popping.

teambob commented 9 years ago

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

teambob commented 9 years ago

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