diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnotes.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnotes.java index 549a746fc8..2c3d6d7626 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnotes.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnotes.java @@ -123,6 +123,11 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes { @Override protected void commit() throws IOException { + // cannot save anything if class is not initialized fully + if (ctEndnotes == null) { + return; + } + XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTEndnotes.type.getName().getNamespaceURI(), "endnotes")); PackagePart part = getPackagePart(); diff --git a/test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-4961551840247808.docx b/test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-4961551840247808.docx new file mode 100644 index 0000000000..cb604f0cc5 Binary files /dev/null and b/test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-4961551840247808.docx differ diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls index cfc460f7d9..86981ef7c1 100644 Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ