Aspose.PDF throws NegativeArraySizeException with error message "-1118738328" in Java

Hello, Support,

The following exception is reported by Aspose.PDF library for Java when trying to process a particular HTML file in the latest (to date) version of Aspose.PDF product (v 23.11):

exception:
java.lang.NegativeArraySizeException: -1118738328
at com.aspose.pdf.internal.l32l.l1f.lI(Unknown Source)
at com.aspose.pdf.internal.l32l.l1f.lI(Unknown Source)
at com.aspose.pdf.internal.l46p.lb.lj(Unknown Source)
at com.aspose.pdf.internal.l46u.lj.lI(Unknown Source)
at com.aspose.pdf.internal.l46p.lj$lI.lI(Unknown Source)
at com.aspose.pdf.internal.l46p.lj.lI(Unknown Source)
at com.aspose.pdf.internal.l48f.lI.lI(Unknown Source)
at com.aspose.pdf.internal.l48f.lI.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.lc.lc(Unknown Source)
at com.aspose.pdf.internal.l46k.lt.l1n(Unknown Source)
at com.aspose.pdf.internal.l46k.l0l.l6f(Unknown Source)
at com.aspose.pdf.internal.l46k.l0l.l6f(Unknown Source)
at com.aspose.pdf.internal.l46k.l0l.l6f(Unknown Source)
at com.aspose.pdf.internal.l46k.l0l.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l0l.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.lk.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.lk.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l1l.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l1l.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l1l.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l1l.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l3n.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.lf.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l3n.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l3n.lj(Unknown Source)
at com.aspose.pdf.internal.l46k.lf.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l3n.lI(Unknown Source)
at com.aspose.pdf.internal.l46k.l4if.l2n(Unknown Source)
at com.aspose.pdf.internal.l42k.lb.lf(Unknown Source)
at com.aspose.pdf.internal.l44u.lk.l0p(Unknown Source)
at com.aspose.pdf.internal.l43k.lf.lI(Unknown Source)
at com.aspose.pdf.internal.l43k.lf.lI(Unknown Source)
at com.aspose.pdf.internal.l43k.lf.lI(Unknown Source)
at com.aspose.pdf.internal.l42y.lj.lI(Unknown Source)
at com.aspose.pdf.internal.l42n.lI.lI(Unknown Source)
at com.aspose.pdf.internal.l51h.lI.lI(Unknown Source)
at com.aspose.pdf.internal.l43j.lt.lI(Unknown Source)
at com.aspose.pdf.internal.l43j.lf.lj(Unknown Source)
at com.aspose.pdf.internal.html.collections.lj.lj(Unknown Source)
at com.aspose.pdf.internal.html.collections.lj.hasNext(Unknown Source)
at com.aspose.pdf.internal.l51h.lI.lI(Unknown Source)
at com.aspose.pdf.internal.html.rendering.l0if.lI(Unknown Source)
at com.aspose.pdf.internal.html.rendering.l0if.lI(Unknown Source)
at com.aspose.pdf.internal.html.rendering.l1t.lI(Unknown Source)
at com.aspose.pdf.internal.html.rendering.l1t.lI(Unknown Source)
at com.aspose.pdf.l7n.lf(Unknown Source)
at com.aspose.pdf.l7n.lI(Unknown Source)
at com.aspose.pdf.l7n.lI(Unknown Source)
at com.aspose.pdf.ADocument.lI(Unknown Source)
at com.aspose.pdf.ADocument.(Unknown Source)
at com.aspose.pdf.Document.(Unknown Source)

The affected file is attached.
Shohei Ohtani Free Agency News and Rumors.zip (66.1 KB)

Please, let me know if you have any questions.

Regards,
Eugene

@edushkin.epiq

Would you please share the sample code snippet that you have been using in your environment?

@asad.ali, yes, absolutely - here is the calling code:

    // Set margin
    MarginInfo marginInfo = new MarginInfo();
    marginInfo.setTop(35);
    marginInfo.setBottom(35);
    marginInfo.setLeft(35);
    marginInfo.setRight(35);

    // Set page
    PageInfo pageInfo = new PageInfo();
    pageInfo.setMargin(marginInfo);

    // Set html option
    HtmlLoadOptions options = new HtmlLoadOptions();
    options.setPageInfo(pageInfo);

    // Open pdf document with the html file
    try (Document pdfDocument = new Document(htmlFilePath, options)) {

I can give you the rest of the code, but the “try () {” line is where the exception is thrown.

@edushkin.epiq

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): PDFJAVA-43403

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.

@asad.ali has this been fixed?

@aweech

Regretfully, the ticket could not get resolved yet due to other issues in the queue. However, we have logged your concerns and will surely inform you once we have some update in this regard.