OpenXML: XLSX files with missing cellXfs/xf/@fillId attribute will crash during parsing

Issue #576 resolved
Chase Tingley created an issue

The xl/styles.xml file inside an XLSX file contains style data we parse in order to generate formatting codes. Cell styles contain a fillId attribute. This attribute is optional in the schema, but the filter assumes it is present and crashes if it is not.

Clean testcase attached. I constructed this one by hand, as Office doesn't generate files this way. The file where this was spotted in the wild was apparently created by Numbers.

Bug was tracked down with the help of Nathanael Burt.

Stack:

    at net.sf.okapi.filters.openxml.ExcelStyles.parse(ExcelStyles.java:95)
    at net.sf.okapi.filters.openxml.ExcelDocument.parseStyles(ExcelDocument.java:142)
    at net.sf.okapi.filters.openxml.ExcelDocument.initialize(ExcelDocument.java:56)
    at net.sf.okapi.filters.openxml.OpenXMLZipFileProxy.createDocument(OpenXMLZipFileProxy.java:36)
    at net.sf.okapi.filters.openxml.OpenXMLFilter.openZipFile(OpenXMLFilter.java:414)
    at net.sf.okapi.filters.openxml.OpenXMLFilter.next(OpenXMLFilter.java:260)

Comments (1)

  1. Log in to comment