Microsoft Word 6.0/95 document throws FileCorruptedException in Aspose.Words .NET >= 19.7

The attached two Microsoft Word 6.0/95 documents throw an Aspose.Words.FileCorruptedException when opened with Aspose.Words for .Net >= 19.7 (including 19.9). If I reference a version < 19.7, the exception is not thrown.

Repro

// arrange
var lic = new License();
lic.SetLicense("Aspose.Words.lic");
var path1 = @"D:\test1.doc";
var path2 = @"D:\test2.doc";

// act & assert
Assert.Throws<Aspose.Words.FileCorruptedException>(() => new Document(path1));
Assert.Throws<Aspose.Words.FileCorruptedException>(() => new Document(path2, new LoadOptions { LoadFormat = LoadFormat.Doc }));

The code opening the document is within a class library targeting .NET Standard 2.0.

I’d be grateful if you could fix this issue.

tests.zip (8.1 KB)

Regards,
Daniel

@Daniel9999999,

We tested the scenarios and have managed to reproduce the same problems on our end. For the sake of corrections, we have logged the following issues in our issue tracking system.

WORDSNET-19327: related to test1.doc
WORDSNET-19328: related to test2.doc

We will further look into the details of these issues and will keep you updated on the status of corrections. We apologize for your inconvenience.

1 Like

The issues you have found earlier (filed as WORDSNET-19327,WORDSNET-19328) have been fixed in this Aspose.Words for .NET 19.11 update and this Aspose.Words for Java 19.11 update.

1 Like

I’m getting this exception now too with Aspose.Words 25.11.0 running in an ASP.NET Core 9 web application. I have attached the document.
Calfee_GratTax_Spring_2015.docx (3.9 MB)

@pmarangoni The problem is not reproducible on my side with the following simple code:

Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out.docx");
Aspose.Words.FileCorruptedException
  HResult=0x80131500
  Message=The document appears to be corrupted and cannot be loaded.
  Source=Aspose.Words
  StackTrace:
   at Aspose.Words.Document.v(Stream d, LoadOptions v)
   at Aspose.Words.Document.d(Stream d, LoadOptions v)
   at Aspose.Words.Document..ctor(String fileName, LoadOptions loadOptions)
   at Aspose.Words.Document..ctor(String fileName)
   
Inner Exception 1:
NullReferenceException: Object reference not set to an instance of an object.

@pmarangoni As I have mentioned, the problem is not reproducible on my side. Could you please provide code you use to load the document? The problem might occur because the document is loaded from stream and the data in the stream is damaged or stream position is incorrect. Please try loading the document from file, like shown above, for testing purpose.