Created attachment 36553 [details] File to reproduce the crash. Excel and Libreoffice calc is able to open the file, although it doesn't follow the spec here.[1] POI should also gracefully handle this. Attaching a couple of repro documents. Sample Code to Repro : package poitesting; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFWorkbook; public class POITest { public static void main(String args[]) throws IOException { FileInputStream file = new FileInputStream(new File("/Users/spri/Desktop/temp/INV17040213.xls")); // Get the workbook instance for XLS file try { HSSFWorkbook workbook = new HSSFWorkbook(file); System.err.println(workbook.getNumberOfSheets()); workbook.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } [1]https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/fc5bb3ce-8e35-4393-b22f-9cf54062a3a4 Stack Trace : Exception in thread "main" org.apache.poi.util.RecordFormatException: Unexpected size (0) at org.apache.poi.hssf.record.FtCfSubRecord.<init>(FtCfSubRecord.java:60) at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:70) at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:91) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) at org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:84) at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:342) at org.apache.poi.hssf.record.RecordFactoryInputStream.readNextRecord(RecordFactoryInputStream.java:301) at org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:267) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:491) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:343) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:400) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:381) at poitesting.POITest.main(POITest.java:21)
Created attachment 36554 [details] Another File to reproduce the crash.
Gentle Ping. Could someone take a look at this please?
Gentle ping. Can someone please investigate?
Seems nobody found time to take a look yet... If you would like to get this pushed forward, your best bet is to work on a patch yourself and submit it here, this usually increases chances of changes being made more quickly. See http://poi.apache.org/devel/index.html and http://poi.apache.org/devel/guidelines.html#SubmittingPatches for some related instructions.