diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java index 07d00bd99a..590251960a 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java @@ -259,7 +259,7 @@ public class ReadOnlySharedStringsTable extends DefaultHandler implements Shared } else if ("rPh".equals(localName)) { inRPh = true; //append space...this assumes that rPh always comes after regular - if (includePhoneticRuns && characters.length() > 0) { + if (includePhoneticRuns && characters != null && characters.length() > 0) { characters.append(" "); } } @@ -287,7 +287,9 @@ public class ReadOnlySharedStringsTable extends DefaultHandler implements Shared public void characters(char[] ch, int start, int length) throws SAXException { if (tIsOpen) { if (inRPh && includePhoneticRuns) { - characters.append(ch, start, length); + if (characters != null) { + characters.append(ch, start, length); + } } else if (! inRPh){ if (characters != null) { characters.append(ch, start, length); diff --git a/test-data/spreadsheet/clusterfuzz-testcase-minimized-XLSX2CSVFuzzer-6504225896792064.xlsx b/test-data/spreadsheet/clusterfuzz-testcase-minimized-XLSX2CSVFuzzer-6504225896792064.xlsx new file mode 100644 index 0000000000..9426600d72 Binary files /dev/null and b/test-data/spreadsheet/clusterfuzz-testcase-minimized-XLSX2CSVFuzzer-6504225896792064.xlsx differ diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls index d1b01472d3..b797f92f28 100644 Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ