Image Java crashes JVM when loading tiff file

Aspose Team,
We use the Aspose Image java package to load tiff file and count the pages, and found out that it crashes the program (or the JVM) in production environment with the sample file.
Note that we cannot reproduce the problem in non-production environment.

Following is the sample code. I failed to upload the sample file (24 MB) because it is too larger.
The operating system is Ubuntu 20.04. Java version is 21. Aspose Image java packages is 24.2.

import com.aspose.imaging.Image;
import com.aspose.imaging.fileformats.tiff.TiffImage;

public class ImageLoadTiff_29 {
public static void main(String[] args) {
String inputTiff = “/home/ubuntu/winshare/00_Sample_Files/Bug_848676/aio_converted.tif”;
try {
new com.aspose.email.License().setLicense(“/home/ubuntu/QmulusWorker/required/Aspose.Total.Java.lic”);
System.out.println("get page count file " + inputTiff);
try(TiffImage tiff = (TiffImage) Image.load(inputTiff)) {
int pageCount = tiff.getFrames().length;
System.out.println("pageCount = " + pageCount);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}

Can you give me your email address so that I can send you the link of the shared sample file.

Hello @xyang
We appreciate your interest in Aspose.Imaging.
Could you provide the file using the cloud storage? After I download it you can remove it.

@evgeniy.sidenko
Hello @evgeniy.sidenko
Here is the link: removed

Let me know after you get it.
Thank you.

Hello @xyang
Thank you, I downloaded it. But as I can see the sample.zip contains a PDF file 95363.cgi.pdf but in your example, there is a TIFF file named aio_converted.tif. Are you sure that you sent me what you intended to send?
Aspose.Imaging can not load PDF it can only export into PDF.

Hi @evgeniy.sidenko

Sorry, I put the wrong file (note that tiff was converted from that pdf with GhostScript).

Here is the link for the tiff file: removed

Thank you, I have downloaded the TIFF, you may delete it.
I need some time to check it.

@xyang
This issue can be reproduced in Windows/Ubuntu with Java 21. With Java 17 there is no problem.
We create a new ticket for investigation.
PS:
A little trick - the best way to get known the page count is to call method tiff.getPageCount() instead of tiff.getFrames().length.

@xyang
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): IMAGINGJAVA-8702

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.

@evgeniy.sidenko

I also reproduced the problem with the sample code with java 21 in ubuntu. I actually used java 17 previously and failed to reproduce it with the sample code.

Hi, @xyang
Yes, I confirmed it. Java 17 works correctly with Aspose.Imaging. We are going to investigate why using Java 21 causes this issue.

Using the java options -Xverify:none with Java 21 allows to avoid this bug.
In may case this command crushes

java -cp "aspose-imaging-24.2-jdk16.jar;." LinuxTest

But this one works fine

java -Xverify:none -cp "aspose-imaging-24.2-jdk16.jar;." LinuxTest

@xyang
This issue will be fixed in Aspose.Imaging for Java 24.4 that will be accessible in April