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
}
}