aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml/src
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-09-21 15:06:28 +0000
committerDominik Stadler <centic@apache.org>2023-09-21 15:06:28 +0000
commitc79fb75cbccccfa65aa7343a793f6284dd7510f0 (patch)
treef5d1d00384d4710d31395fc04fca24f2f29e50c2 /poi-ooxml/src
parenta9aa91a9ed443e73b39cf038bea9ea7a586661f8 (diff)
downloadpoi-c79fb75cbccccfa65aa7343a793f6284dd7510f0.tar.gz
poi-c79fb75cbccccfa65aa7343a793f6284dd7510f0.zip
Bug 66425: Avoid exceptions found via poi-fuzz
We try to avoid throwing NullPointerException, ClassCastExceptions and StackOverflowException, but it was possible to trigger them Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62548 and https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62564 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912464 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFDiagram.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFDiagram.java b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFDiagram.java
index 9837b5c128..2d14b4f13c 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFDiagram.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFDiagram.java
@@ -214,8 +214,12 @@ public class XSLFDiagram extends XSLFGraphicFrame {
CTGroupShapeProperties groupShapePropsCt = groupShapeCt.addNewGrpSpPr();
CTGroupShapeNonVisual groupShapeNonVisualCt = groupShapeCt.addNewNvGrpSpPr();
- groupShapeNonVisualCt.setCNvPr(msGroupShapeCt.getNvGrpSpPr().getCNvPr());
- groupShapeNonVisualCt.setCNvGrpSpPr(msGroupShapeCt.getNvGrpSpPr().getCNvGrpSpPr());
+ final com.microsoft.schemas.office.drawing.x2008.diagram.CTGroupShapeNonVisual nvGrpSpPr =
+ msGroupShapeCt.getNvGrpSpPr();
+ if (nvGrpSpPr != null) {
+ groupShapeNonVisualCt.setCNvPr(nvGrpSpPr.getCNvPr());
+ groupShapeNonVisualCt.setCNvGrpSpPr(nvGrpSpPr.getCNvGrpSpPr());
+ }
groupShapeNonVisualCt.setNvPr(CTApplicationNonVisualDrawingProps.Factory.newInstance());
for (CTShape msShapeCt : msGroupShapeCt.getSpList()) {