Bug 63390 - org.apache.poi.hssf.record.FtCfSubRecord.<init>(FtCfSubRecord.java:60)
Summary: org.apache.poi.hssf.record.FtCfSubRecord.<init>(FtCfSubRecord.java:60)
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 4.0.0-FINAL
Hardware: Macintosh Mac OS X 10.1
: P1 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-29 11:26 UTC by Priyanshu Srivastava
Modified: 2023-12-21 08:59 UTC (History)
2 users (show)



Attachments
File to reproduce the crash. (24.10 KB, patch)
2019-04-29 11:26 UTC, Priyanshu Srivastava
Details | Diff
Another File to reproduce the crash. (46.41 KB, application/x-ole-storage)
2019-04-29 11:53 UTC, Priyanshu Srivastava
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Priyanshu Srivastava 2019-04-29 11:26:27 UTC
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)
Comment 1 Priyanshu Srivastava 2019-04-29 11:53:57 UTC
Created attachment 36554 [details]
Another File to reproduce the crash.
Comment 2 Priyanshu Srivastava 2019-05-01 08:48:40 UTC
Gentle Ping. Could someone take a look at this please?
Comment 3 Priyanshu Srivastava 2019-05-06 16:53:40 UTC
Gentle ping. Can someone please investigate?
Comment 4 Dominik Stadler 2019-05-06 18:38:45 UTC
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.