Browse Source

Bug 66425: Avoid exceptions found via poi-fuzz

Prevent a NullPointerException

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66386

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1917069 13f79535-47bb-0310-9956-ffa450edef68
pull/624/head
Dominik Stadler 2 weeks ago
parent
commit
c4e8388742

+ 3
- 2
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java View File

@@ -63,9 +63,10 @@ public final class XSSFGraphicFrame extends XSSFShape {
for (int i = 0; i < nodes.getLength(); i++) {
final Node node = nodes.item(i);
// if the frame references a chart, associate the chart with this instance
if (node.getNodeName().equals("c:chart")) {
Node namedItem = node.getAttributes().getNamedItem("r:id");
if (node.getNodeName().equals("c:chart") && namedItem != null) {
// this better succeed or the document is invalid
POIXMLDocumentPart relation = drawing.getRelationById(node.getAttributes().getNamedItem("r:id").getNodeValue());
POIXMLDocumentPart relation = drawing.getRelationById(namedItem.getNodeValue());
// Do XWPF charts need similar treatment?
if (relation instanceof XSSFChart) {
((XSSFChart) relation).setGraphicFrame(this);

BIN
test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-4828727001088000.xlsx View File


BIN
test-data/spreadsheet/stress.xls View File


Loading…
Cancel
Save