First let me explain why I am testing this way. We accept many files from many users. As such I would like to maintain stability when someone is being purposely mischievous/malicious.
Here is my code that loads either rtfs or docs.
try
{
this.highResolutionTimer.Start();
this.documentPath = documentPath;
if (ConfigSettings.AsposeInteractsWithMemoryStream)
{
using (FileStream fs = new FileStream(this.documentPath, FileMode.Open))
{
if (fs.CanRead)
{
MemoryStream ms = new MemoryStream();
fs.CopyTo(ms);
this.wordsDocument = new Aspose.Words.Document(ms);
}
}
}
else
{
this.wordsDocument = new Aspose.Words.Document(this.documentPath);
}
}
catch (Aspose.Words.FileCorruptedException wordsException)
{
Logger.LogError(“Aspose.Words file corrupted exception reading {0}. Message: {1}”, this.documentPath, wordsException.Message);
}
catch(Aspose.Words.IncorrectPasswordException wordsException)
{
Logger.LogError(“Aspose.Words incorrect password reading {0}. Message: {1}”, this.documentPath, wordsException.Message);
}
catch (Aspose.Words.UnsupportedFileFormatException wordsException)
{
Logger.LogError(“Aspose.Words unsuppoted format exception reading {0}. Message: {1}”, this.documentPath, wordsException.Message);
}
catch (Exception ex)
{
Logger.LogError(“System exception reading {0}. Message: {1}”, this.documentPath, ex.Message);
}
finally
{
this.highResolutionTimer.Stop();
Logger.LogInfo(“Aspose.Words took {0} seconds to open {1}”, this.highResolutionTimer.ElapsedTime, this.documentPath);
}
Here are documents. These files a purposely random junk.
https://www.dropbox.com/s/adr84pgmpgtpbmz/RandomJunk.doc?dl=0My guess is that Aspose keeps allocating pages.
MS word basically stops allocating pages and stops at it’s page limit relativity quickly. Aspose.Words allocates a lot of memory and keeps processing for many minutes.
Is there any way to limit the number of pages Aspose.Words will process.