I crafted a test Excel document in Excel 2003, putting embedded Word and PowerPoint objects inside it. I didn't expect it to handle these, but what it did was much worse than my expectations. :-) Test code and file will be attached in a minute, results in the following exception. java.lang.NegativeArraySizeException at org.apache.poi.ddf.UnknownEscherRecord.fillFields(UnknownEscherRecord.java:76) at org.apache.poi.ddf.EscherContainerRecord.fillFields(EscherContainerRecord.java:56) at org.apache.poi.ddf.EscherContainerRecord.fillFields(EscherContainerRecord.java:56) at org.apache.poi.hssf.record.AbstractEscherHolderRecord.convertToEscherRecords(AbstractEscherHolderRecord.java:101) at org.apache.poi.hssf.record.AbstractEscherHolderRecord.decode(AbstractEscherHolderRecord.java:293) at org.apache.poi.hssf.usermodel.HSSFWorkbook.getAllPictures(HSSFWorkbook.java:1337)
Created attachment 20659 [details] Test.java
Created attachment 20660 [details] ole2-embedding.xls
Created attachment 20662 [details] Proposed fix Code in EscherBlipRecord.getRecordSize() was saying that the length of the record was the length of the blip data plus 4, but the header size is actually 8. Fixed by using the actual HEADER_SIZE constant. File now at least parses as expected.
Thanks, patch applied, and tests added