diff --git a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSheet.java index 4fc072ef951..128fcbd41ed 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSheet.java @@ -395,7 +395,11 @@ protected CTGroupShape getSpTree(){ if(sp.length == 0) { throw new IllegalStateException("CTGroupShape was not found"); } - _spTree = (CTGroupShape)sp[0]; + XmlObject xmlObject = sp[0]; + if (!(xmlObject instanceof CTGroupShape)) { + throw new IllegalArgumentException("Had unexpected type of entry: " + xmlObject.getClass()); + } + _spTree = (CTGroupShape) xmlObject; } return _spTree; } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSlide.java b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSlide.java index c48c8d162f6..0b9e6a32129 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSlide.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSlide.java @@ -271,9 +271,9 @@ public XSLFTheme getTheme(){ */ @Override public XSLFBackground getBackground() { - CTBackground bg = _slide.getCSld().getBg(); - if(bg != null) { - return new XSLFBackground(bg, this); + if(_slide.getCSld() != null && + _slide.getCSld().getBg() != null) { + return new XSLFBackground(_slide.getCSld().getBg(), this); } else { return getMasterSheet().getBackground(); } diff --git a/test-data/slideshow/clusterfuzz-testcase-minimized-POIXSLFFuzzer-5463285576892416.pptx b/test-data/slideshow/clusterfuzz-testcase-minimized-POIXSLFFuzzer-5463285576892416.pptx new file mode 100644 index 00000000000..1038f440c2e Binary files /dev/null and b/test-data/slideshow/clusterfuzz-testcase-minimized-POIXSLFFuzzer-5463285576892416.pptx differ diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls index b797f92f285..75b297f57eb 100644 Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ