diff options
author | Dominik Stadler <centic@apache.org> | 2023-09-13 07:48:22 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-09-13 07:48:22 +0000 |
commit | 4b70989156fd31dd9b8fe8eeceea70553330293a (patch) | |
tree | 4e64b7f680a446bdb4d4ab00327b92fd405556b1 | |
parent | ca681fd7061f8db6af0749646ee5e1a7ba8ce447 (diff) | |
download | poi-4b70989156fd31dd9b8fe8eeceea70553330293a.tar.gz poi-4b70989156fd31dd9b8fe8eeceea70553330293a.zip |
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
Fixes https://oss-fuzz.com/testcase-detail/5265527465181184
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912277 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java | 4 | ||||
-rw-r--r-- | test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-5265527465181184.xlsx | bin | 0 -> 10483 bytes |
2 files changed, 3 insertions, 1 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java index 47d9c22dd0..0ede2c2c5f 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java @@ -54,8 +54,10 @@ public final class XSSFGraphicFrame extends XSSFShape { protected XSSFGraphicFrame(XSSFDrawing drawing, CTGraphicalObjectFrame ctGraphicFrame) { this.drawing = drawing; // protected field on XSSFShape this.graphicFrame = ctGraphicFrame; + // TODO: there may be a better way to delegate this - CTGraphicalObjectData graphicData = graphicFrame.getGraphic().getGraphicData(); + CTGraphicalObjectData graphicData = graphicFrame.getGraphic() == null ? + null : graphicFrame.getGraphic().getGraphicData(); if (graphicData != null) { NodeList nodes = graphicData.getDomNode().getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { diff --git a/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-5265527465181184.xlsx b/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-5265527465181184.xlsx Binary files differnew file mode 100644 index 0000000000..3a25e5588c --- /dev/null +++ b/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-5265527465181184.xlsx |