Author: centic
Date: Wed Apr 17 18:15:38 2024
New Revision: 1917069

URL: http://svn.apache.org/viewvc?rev=1917069&view=rev
Log:
Bug 66425: Avoid exceptions found via poi-fuzz

Prevent a NullPointerException

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

Added:
    
poi/trunk/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-4828727001088000.xlsx
Modified:
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
    poi/trunk/test-data/spreadsheet/stress.xls

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java?rev=1917069&r1=1917068&r2=1917069&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java
 Wed Apr 17 18:15:38 2024
@@ -63,9 +63,10 @@ public final class XSSFGraphicFrame exte
             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);

Added: 
poi/trunk/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-4828727001088000.xlsx
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-4828727001088000.xlsx?rev=1917069&view=auto
==============================================================================
Binary files 
poi/trunk/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-4828727001088000.xlsx
 (added) and 
poi/trunk/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIXSSFFuzzer-4828727001088000.xlsx
 Wed Apr 17 18:15:38 2024 differ

Modified: poi/trunk/test-data/spreadsheet/stress.xls
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/stress.xls?rev=1917069&r1=1917068&r2=1917069&view=diff
==============================================================================
Binary files - no diff available.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to