This is an automated email from the ASF dual-hosted git repository.

centic pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git

commit 839ce4a0f4e27959d4001472ff12ec62aec4450c
Author: Dominik Stadler <[email protected]>
AuthorDate: Thu Feb 19 20:19:41 2026 +0100

    Avoid NPE in HSSFShapeGroup.setShapeId()
---
 .../apache/poi/hssf/usermodel/HSSFShapeGroup.java   |   6 +++++-
 .../apache/poi/hssf/model/TestDrawingAggregate.java |   3 ++-
 .../spreadsheet/LIBRE_OFFICE-94379-0.zip-57.xls     | Bin 0 -> 37376 bytes
 test-data/spreadsheet/stress.xls                    | Bin 79872 -> 80384 bytes
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java 
b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java
index 76cd1f76d1..e1f1f9c2fc 100644
--- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java
+++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java
@@ -355,7 +355,11 @@ public class HSSFShapeGroup extends HSSFShape implements 
HSSFShapeContainer {
         EscherContainerRecord containerRecord = 
getEscherContainer().getChildById(EscherContainerRecord.SP_CONTAINER);
         EscherSpRecord spRecord = 
containerRecord.getChildById(EscherSpRecord.RECORD_ID);
         spRecord.setShapeId(shapeId);
-        CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord) 
getObjRecord().getSubRecords().get(0);
+        ObjRecord objRecord = getObjRecord();
+        if (objRecord == null) {
+            throw new IllegalStateException("Did not have an ObjRecord for the 
HSSFShapeGroup");
+        }
+        CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord) 
objRecord.getSubRecords().get(0);
         cod.setObjectId((short) (shapeId % 1024));
     }
 
diff --git 
a/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java 
b/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java
index f326f17b07..e14464ba80 100644
--- a/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java
+++ b/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java
@@ -139,7 +139,8 @@ class TestDrawingAggregate {
                         
!file.getName().equals("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5285517825277952.xls")
 &&
                         
!file.getName().equals("clusterfuzz-testcase-minimized-POIHSSFFuzzer-4977868385681408.xls")
 &&
                         
!file.getName().equals("crash-e329fca9087fe21bca4a80c8bc472a661c98d860.xls") &&
-                        
!file.getName().equals("cf9f845e73447b092477d0472402a5baea4b8c9f.xls")).
+                        
!file.getName().equals("cf9f845e73447b092477d0472402a5baea4b8c9f.xls") &&
+                        
!file.getName().equals("LIBRE_OFFICE-94379-0.zip-57.xls")).
                 map(Arguments::of);
     }
 
diff --git a/test-data/spreadsheet/LIBRE_OFFICE-94379-0.zip-57.xls 
b/test-data/spreadsheet/LIBRE_OFFICE-94379-0.zip-57.xls
new file mode 100755
index 0000000000..ee6186ad92
Binary files /dev/null and 
b/test-data/spreadsheet/LIBRE_OFFICE-94379-0.zip-57.xls differ
diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls
index cd4be7f1dc..b0f95e64b3 100644
Binary files a/test-data/spreadsheet/stress.xls and 
b/test-data/spreadsheet/stress.xls differ


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

Reply via email to