Avoid NPE in HSSFShapeGroup.setShapeId()

This commit is contained in:
Dominik Stadler 2026-02-19 20:19:41 +01:00
parent 260b22fb09
commit 839ce4a0f4
4 changed files with 7 additions and 2 deletions

View File

@ -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));
}

View File

@ -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);
}

Binary file not shown.

Binary file not shown.