diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java index 84a02e10f78..225a8f496e5 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java @@ -71,11 +71,11 @@ protected XWPFHeaderFooter() { */ public XWPFHeaderFooter(POIXMLDocumentPart parent, PackagePart part) { super(parent, part); - this.document = (XWPFDocument) getParent(); - - if (this.document == null) { - throw new NullPointerException(); + final POIXMLDocumentPart p = getParent(); + if (!(p instanceof XWPFDocument)) { + throw new IllegalArgumentException("Had unexpected type of parent: " + (p == null ? "" : p.getClass())); } + this.document = (XWPFDocument) p; } @Override diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java index 074a9416692..83ed6c11f11 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java @@ -271,4 +271,12 @@ public static XWPFRelation getInstance(String rel) { return _table.get(rel); } + @Override + public String toString() { + return "XWPFRelation{" + + //getRelation() + "/" + + getContentType() + "/" + + getDefaultFileName() + + "}"; + } } diff --git a/test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-4959857092198400.docx b/test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-4959857092198400.docx new file mode 100644 index 00000000000..fc5d3884222 Binary files /dev/null and b/test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-4959857092198400.docx differ diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls index a47f99b2cb7..eeecaeb553f 100644 Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ