Created attachment 24360 [details] Sample file Put the sample file somewhere, adjust this test to point to the correct file location and run. @Test public void testPictureExtractionProblem() throws Exception { File file = new File("C:\\Data\\Test\\NUIQ021202.doc"); POIFSFileSystem poifs; InputStream stream = new FileInputStream(file); try { poifs = new POIFSFileSystem(stream); } finally { stream.close(); } HWPFDocument doc = new HWPFDocument(poifs); // Throws ArrayIndexOutOfBoundsException doc.getPicturesTable().getAllPictures(); } Gives the following error: java.lang.ArrayIndexOutOfBoundsException: 50206 at org.apache.poi.util.LittleEndian.getShort(LittleEndian.java:45) at org.apache.poi.ddf.EscherRecord$EscherRecordHeader.readHeader(EscherRecord.java:250) at org.apache.poi.ddf.DefaultEscherRecordFactory.createRecord(DefaultEscherRecordFactory.java:56) at org.apache.poi.hwpf.model.PicturesTable.searchForPictures(PicturesTable.java:171) at org.apache.poi.hwpf.model.PicturesTable.searchForPictures(PicturesTable.java:178) at org.apache.poi.hwpf.model.PicturesTable.searchForPictures(PicturesTable.java:178) at org.apache.poi.hwpf.model.PicturesTable.getAllPictures(PicturesTable.java:202) There does appear to be a picture in the document but it's unknown to me whether it's embedded directly or via an OLE2 container (what is known is that there *is* one OLE2 container in the file.)
Still have the problem in trunk. Yegor
*** Bug 50936 has been marked as a duplicate of this bug. ***
I added workaround to skip pictures that can't be loaded and print an exception for those in logs. It turns out in example files we have more records than pictures present. Done in revision 1195080