Corrupted PDF causing memory leak

Hello Aspose Team,

I’m seeing very high memory usage when processing a corrupted PDF with Aspose.PDF.Drawing 26.3.0 on Linux / .NET 8.

In my sample project, I open the PDF with new Document(inputPath) and then run TextFragmentAbsorber page by page. For this malformed file, memory grows significantly during processing instead of failing cleanly.

Expected behavior:
Either process safely, or throw an exception for an invalid/corrupted PDF, but avoid excessive memory growth.

Could you please clarify:

  1. Is this a known issue in Aspose.PDF.Drawing 26.3.0?
  2. Is there a recommended way to validate a PDF before processing so corrupted files can be rejected early?
  3. Is there any workaround or safer loading mode for malformed PDFs?

CorruptedPdfMemoryLeak.zip (159.5 KB)

@erdeiga
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-62140

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi
I believe that the main approach to check broken PDF looks something like this:

string tempPath = OutputFolder + "corrupted_pdf_temp.pdf";
var document = new Document(inputPath);
if (document.IsRepairNeeded(out var options))
{
    document.Repair(options);
    document.Save(tempPath);
    document = new Document(tempPath);
}

but in this case it doesn’t work
I’ve checked and haven’t found similar issues, so I’ll register this one as I don’t think there’s another workaround - the procedure of opening document is usually pretty straightforward

1 Like