Infinite loop while loading a Diagram

Hi Aspose,
we found a problem when loading a corrupt file as a Diagram. The file contains only zeroes. Attempting to load that file with the constructor

public Diagram(java.io.InputStream inputStream)

results in an infinite loop.
When specifying the expected file type LoadFileFormat.VSD in the LoadOptions the invalid file content is correctly detected and an exception is thrown. While I am trying to guess the file format based on the extension and call the more specific constructor first I would still like to use the “automatic” constructor as a fallback in case there is no extension or the extension does not match the actual file type.

test method to reproduce the bug:

@Test
public void testLoadZeroesAsDiagram() {
	byte[] data = new byte[1899520];
	try {
		new Diagram(new ByteArrayInputStream(data));
		Assert.fail("Exception expected");
	}
	catch (Exception e) {
		// expected
	}
}

@ruedee

Could you please share you sample Diagram file with us. We will test the scenario in our environment and address it accordingly.

the file is 1899520 bytes of zeros, the exact same data as you can see in the unit test in my original post.

@ruedee

We have logged a feature request as DIAGRAMJAVA-50698 in our issue tracking system to implement the exception handling in case of corrupt diagram loading attempt. We will further investigate the feasibility of this feature and keep you posted with the status of its implementation. Please be patient and spare us some time.

@ruedee

We would like to share with you that your issue has been resolved in Aspose.Diagram for Java 20.6.1 hotfix.

The issues you have found earlier (filed as DIAGRAMJAVA-50698) have been fixed in Aspose.Diagram for Java 20.7.