https://issues.apache.org/bugzilla/show_bug.cgi?id=47958

           Summary: ArrayIndexOutOfBoundsException from
                    PicturesTable.getAllPictures() during Escher tree walk
           Product: POI
           Version: 3.5-FINAL
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HWPF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=24360)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24360)
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.)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to