StackOverflow error when converting word to pdf

I get StackOverflow exception when converting word document to pdf. I use Aspose.Words for .NET and I am able to reproduce the bug with version 24.4.0 and higher, even in most recent 26.6.0. Platform is irrelevant - the error persists on both on Linux and Windows.

Here’s the file:
conversionTest.docx (324,5 КБ)

Here’s error text:

Stack overflow.
Repeated 4583 times:
--------------------------------
   at JUZ.rUZiFn()
   at rUZ.rUZiFd(GUq)
   at rUZ.rUZiFd(GUq)
   at rUZ.rUZiFd(GUq)
   at rUZ.Q()
--------------------------------
   at JUZ.rUZiFn()
   at YU5.u()
   at YU5.B()
   at aU0.b()
   at aU0.d(Boolean)
   at aU0.g()
   at HC.APiFd(aU0)
   at aU0.pU0iFd(AP)
   at HC.d(aU0)
   at HC.d(aU0, NU0)
   at Aspose.Words.Document.d(Int32, HC)
   at GUR.v(wCS, HC)
   at GUR.SU7iFd(wCS)
   at CUS.CUSiFd(wCS)
   at Aspose.Words.Document.d(wCS)
   at Aspose.Words.Document.d(System.IO.Stream, System.String, Aspose.Words.Saving.SaveOptions)
   at Aspose.Words.Document.Save(System.IO.Stream, Aspose.Words.Saving.SaveOptions)
   at Aspose.Words.Document.Save(System.IO.Stream, Aspose.Words.SaveFormat)
   at WordToPdf.Program.ParseFileToPdfTest(System.IO.Stream)
   at WordToPdf.Program.Main(System.String[])

Here’s code to reproduce:

private static byte[] ParseFileToPdfTest(Stream input)
{
    Aspose.Words.Document wordDocument = new Aspose.Words.Document(input);
    using MemoryStream output = new();
    wordDocument.Save(output, Aspose.Words.SaveFormat.Pdf);
    return output.ToArray();
}

The error is somehow linked to the comments in document. If I delete the comments before saving as pdf then saving is completed without errors. It is not an option though as I need to get pdf with all the content including comments.

Here’s code sample to delete comments:

private static void ClearAllDocumentComments(Document document)
{
    NodeCollection comments = document.GetChildNodes(NodeType.Comment, true);
    if (comments.Count > 0)
        comments.Clear();
}

@NOborin
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): WORDSNET-29342

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.

Provide the status of the ticket please. Has this issue been resolved?

@NOborin Yes, the issue is already resolved in the current codebase. The fix will be included in the upcoming 26.7 version of Aspose.Words. We will be sure to let you know once it is published.

The issues you have found earlier (filed as WORDSNET-29342) have been fixed in this Aspose.Words for .NET 26.7 update also available on NuGet.