https://bz.apache.org/bugzilla/show_bug.cgi?id=60343

            Bug ID: 60343
           Summary: Add bounds checking on style offsets in StylesTable
           Product: POI
           Version: 3.16-dev
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

On TIKA-2155, Seva Alekseyev supplied an xlsx that triggers an index out of
bounds exception when trying to get a style from the StylesTable.  I haven't
tried to open the file in Excel, but Seva has opened it.  The offending value
in sheet67.xml is: <c r="L95" s="65535"/>... truly a bad value.

Stack:

java.lang.IndexOutOfBoundsException: Index: 65535, Size: 251

        at java.util.ArrayList.rangeCheck(ArrayList.java:653)
        at java.util.ArrayList.get(ArrayList.java:429)
        at
org.apache.poi.xssf.model.StylesTable.getStyleAt(StylesTable.java:421)
        at
org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.startElement(XSSFSheetXMLHandler.java:282)

My inclination is to add bounds checking to StylesTable and return null if a
style is requested outside of the list range.  I'll leave this open for a few
days to make sure there are no objections from colleagues that this is making
the parser too lax.

-- 
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