Bug 66425: Avoid a NullPointerException found via oss-fuzz

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

Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61520

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2023-08-23 09:30:00 +00:00
parent fd29772be6
commit 0654bf9d87
3 changed files with 1 additions and 1 deletions

View File

@ -233,7 +233,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
}
}
// Sort out headers and footers
if (doc.getDocument().getBody().getSectPr() != null) {
if (doc.getDocument().getBody() != null && doc.getDocument().getBody().getSectPr() != null) {
headerFooterPolicy = new XWPFHeaderFooterPolicy(this);
}

Binary file not shown.