diff options
author | Dominik Stadler <centic@apache.org> | 2024-04-20 07:53:40 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2024-04-20 07:53:40 +0000 |
commit | d4bcc2b3bbcd9d7dafe9d46c126c9d0e1ddfcdd8 (patch) | |
tree | 4a368615ce89b2d3990fbd96285996ed799e11c8 | |
parent | 8c101982e029100b74b4c18f8743fa35e4ec63ff (diff) | |
download | poi-d4bcc2b3bbcd9d7dafe9d46c126c9d0e1ddfcdd8.tar.gz poi-d4bcc2b3bbcd9d7dafe9d46c126c9d0e1ddfcdd8.zip |
Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65448
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1917175 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java | 7 | ||||
-rw-r--r-- | test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-5166796835258368.docx | bin | 0 -> 12890 bytes |
2 files changed, 5 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java index f9bdfb7ad8..177a570882 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnotes.java @@ -127,8 +127,11 @@ public class XWPFFootnotes extends XWPFAbstractFootnotesEndnotes { XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTFootnotes.type.getName().getNamespaceURI(), "footnotes")); PackagePart part = getPackagePart(); - try (OutputStream out = part.getOutputStream()) { - ctFootnotes.save(out, xmlOptions); + + if (ctFootnotes != null) { + try (OutputStream out = part.getOutputStream()) { + ctFootnotes.save(out, xmlOptions); + } } } diff --git a/test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-5166796835258368.docx b/test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-5166796835258368.docx Binary files differnew file mode 100644 index 0000000000..08e62e49e2 --- /dev/null +++ b/test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-5166796835258368.docx |