Browse Source

Bug 66425: Avoid a ClassCastException found via oss-fuzz

We try to avoid throwing ClassCastException, but it was possible
to trigger one here with a specially crafted input-file

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912140 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_4
Dominik Stadler 8 months ago
parent
commit
aad473eaca

+ 2
- 2
poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java View File

@@ -312,11 +312,11 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
for (RelationPart rp : getRelationParts()) {
POIXMLDocumentPart p = rp.getDocumentPart();
String relation = rp.getRelationship().getRelationshipType();
if (relation.equals(XWPFRelation.FOOTNOTE.getRelation())) {
if (relation.equals(XWPFRelation.FOOTNOTE.getRelation()) && p instanceof XWPFFootnotes) {
this.footnotes = (XWPFFootnotes) p;
this.footnotes.onDocumentRead();
this.footnotes.setIdManager(footnoteIdManager);
} else if (relation.equals(XWPFRelation.ENDNOTE.getRelation())) {
} else if (relation.equals(XWPFRelation.ENDNOTE.getRelation()) && p instanceof XWPFEndnotes) {
this.endnotes = (XWPFEndnotes) p;
this.endnotes.onDocumentRead();
this.endnotes.setIdManager(footnoteIdManager);

BIN
test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-4791943399604224.docx View File


Loading…
Cancel
Save