Преглед изворни кода

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 пре 1 месец
родитељ
комит
c4e8388742

+ 3
- 2
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java Прегледај датотеку

for (int i = 0; i < nodes.getLength(); i++) { for (int i = 0; i < nodes.getLength(); i++) {
final Node node = nodes.item(i); final Node node = nodes.item(i);
// if the frame references a chart, associate the chart with this instance // 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 // 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? // Do XWPF charts need similar treatment?
if (relation instanceof XSSFChart) { if (relation instanceof XSSFChart) {
((XSSFChart) relation).setGraphicFrame(this); ((XSSFChart) relation).setGraphicFrame(this);

BIN
test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-4828727001088000.xlsx Прегледај датотеку


BIN
test-data/spreadsheet/stress.xls Прегледај датотеку


Loading…
Откажи
Сачувај