FileCorruptedException loading RTF file

Hi, we’ve found a problem with Aspose.Words for .NET 19.1. A customer created an RTF file that generates an exception of “Aspose.Words.FileCorruptedException” when loaded, even though the file can be successfully opened and viewed with Microsoft Word. If I edit the file with Word (change a word or two) and save it again as an RTF the problem still exists. I uploaded the RTF file as ‘Cover.zip’.

Cover.zip (608.9 KB)

To reproduce the error, all you need to do is load the file like so in C#:

try
{
Aspose.Words.Document doc = new Aspose.Words.Document(@“C:\Test\Cover.rtf”);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}

The resulting exception:

Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded. —> System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: count
at System.IO.BinaryReader.ReadBytes(Int32 count)
at . …ctor( , BinaryReader )
at . .(BinaryReader )
at .(. )
at … (. )
at …(. )
at … ()
at Aspose.Words.Document.(Stream , LoadOptions )
— End of inner exception stack trace —
at Aspose.Words.Document.(Stream , LoadOptions )
at Aspose.Words.Document.(Stream , LoadOptions )
at Aspose.Words.Document…ctor(String fileName, LoadOptions loadOptions)
at Aspose.Words.Document…ctor(String fileName)
at TestNamespace.Program.Main() in c:\Nick\Test\Program.cs:line 15"

@nickpeck

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18063. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-16496) have been fixed in this update