Skip to content

Commit

Permalink
Bug 66425: Avoid a ClassCastException found via oss-fuzz
Browse files Browse the repository at this point in the history
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
  • Loading branch information
centic9 committed Sep 6, 2023
1 parent 5d073e3 commit aad473e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,11 @@ private void initFootnotes() throws XmlException, IOException {
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);
Expand Down
Binary file not shown.

0 comments on commit aad473e

Please sign in to comment.