mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
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 Fixes https://oss-fuzz.com/testcase-detail/4959857092198400 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912157 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
40cdc76f63
commit
5c2a89412b
@ -71,11 +71,11 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
|
|||||||
*/
|
*/
|
||||||
public XWPFHeaderFooter(POIXMLDocumentPart parent, PackagePart part) {
|
public XWPFHeaderFooter(POIXMLDocumentPart parent, PackagePart part) {
|
||||||
super(parent, part);
|
super(parent, part);
|
||||||
this.document = (XWPFDocument) getParent();
|
final POIXMLDocumentPart p = getParent();
|
||||||
|
if (!(p instanceof XWPFDocument)) {
|
||||||
if (this.document == null) {
|
throw new IllegalArgumentException("Had unexpected type of parent: " + (p == null ? "<null>" : p.getClass()));
|
||||||
throw new NullPointerException();
|
|
||||||
}
|
}
|
||||||
|
this.document = (XWPFDocument) p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -271,4 +271,12 @@ public final class XWPFRelation extends POIXMLRelation {
|
|||||||
return _table.get(rel);
|
return _table.get(rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "XWPFRelation{" +
|
||||||
|
//getRelation() + "/" +
|
||||||
|
getContentType() + "/" +
|
||||||
|
getDefaultFileName() +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user