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 e96c9e17c0a9d0071c65423009a5a8c150b05941 Author: Dominik Stadler <[email protected]> AuthorDate: Sat Feb 14 18:25:36 2026 +0100 Avoid NPE with malformed EscherAggregate --- .../org/apache/poi/hssf/record/EscherAggregate.java | 3 +++ .../org/apache/poi/hssf/dev/TestBiffViewer.java | 1 + .../org/apache/poi/hssf/dev/TestRecordLister.java | 1 + .../apache/poi/hssf/model/TestDrawingAggregate.java | 3 ++- .../cf9f845e73447b092477d0472402a5baea4b8c9f.xls | Bin 0 -> 47616 bytes test-data/spreadsheet/stress.xls | Bin 78848 -> 79360 bytes 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java index 6a0414c31c..fc6d8270b9 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java @@ -292,6 +292,9 @@ public final class EscherAggregate extends AbstractEscherHolderRecord { // Write the matching OBJ record Record obj = shapeToObj.get(shapes.get(i)); + if (obj == null) { + throw new IllegalStateException("Cannot serialize EscherAggregate with missing shape-object"); + } pos += obj.serialize(pos, data); isFirst = false; diff --git a/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java b/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java index 33f28455a8..9d71b5fccd 100644 --- a/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java +++ b/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java @@ -49,6 +49,7 @@ class TestBiffViewer extends BaseTestIteratingXLS { excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-6483562584932352.xls", IndexOutOfBoundsException.class); excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5816431116615680.xls", RecordFormatException.class); excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-4734163573080064.xls", IndexOutOfBoundsException.class); + excludes.put("cf9f845e73447b092477d0472402a5baea4b8c9f.xls", RecordFormatException.class); return excludes; } diff --git a/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java b/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java index eab59c339f..033c201dae 100644 --- a/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java +++ b/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java @@ -52,6 +52,7 @@ class TestRecordLister extends BaseTestIteratingXLS { excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-6483562584932352.xls", RecordFormatException.class); excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5816431116615680.xls", RecordFormatException.class); excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-4734163573080064.xls", IndexOutOfBoundsException.class); + excludes.put("cf9f845e73447b092477d0472402a5baea4b8c9f.xls", RecordFormatException.class); return excludes; } 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 146c69a568..f326f17b07 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 @@ -138,7 +138,8 @@ class TestDrawingAggregate { filter(file -> !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("crash-e329fca9087fe21bca4a80c8bc472a661c98d860.xls") && + !file.getName().equals("cf9f845e73447b092477d0472402a5baea4b8c9f.xls")). map(Arguments::of); } diff --git a/test-data/spreadsheet/cf9f845e73447b092477d0472402a5baea4b8c9f.xls b/test-data/spreadsheet/cf9f845e73447b092477d0472402a5baea4b8c9f.xls new file mode 100644 index 0000000000..6bbcc15bb7 Binary files /dev/null and b/test-data/spreadsheet/cf9f845e73447b092477d0472402a5baea4b8c9f.xls differ diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls index a6db95bc78..feaeaa201d 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]
