From 740a756a3f28280e450f97525fd44d79eb9103e5 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 8 Dec 2018 08:13:36 +0000 Subject: [PATCH] lgtm issues git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1848438 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/ss/formula/functions/MatrixFunction.java | 2 +- src/java/org/apache/poi/util/StringUtil.java | 2 +- src/ooxml/java/org/apache/poi/ooxml/util/POIXMLConstants.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java b/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java index 6b111cfc1a..04e7f4cd77 100644 --- a/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java +++ b/src/java/org/apache/poi/ss/formula/functions/MatrixFunction.java @@ -63,7 +63,7 @@ public abstract class MatrixFunction implements Function{ i = 0; j++; } - matrix[j][i++] = aVector; + if (j < matrix.length) matrix[j][i++] = aVector; } } diff --git a/src/java/org/apache/poi/util/StringUtil.java b/src/java/org/apache/poi/util/StringUtil.java index 302e532570..2017abf125 100644 --- a/src/java/org/apache/poi/util/StringUtil.java +++ b/src/java/org/apache/poi/util/StringUtil.java @@ -698,7 +698,7 @@ public class StringUtil { final String prefix; // #61881 - for now we only check the first char - if (len > 0 && string[offset] == 0 && string[offset+1] == 0) { + if (len > 0 && offset < (string.length - 1) && string[offset] == 0 && string[offset+1] == 0) { newOffset = offset+2; prefix = "?"; diff --git a/src/ooxml/java/org/apache/poi/ooxml/util/POIXMLConstants.java b/src/ooxml/java/org/apache/poi/ooxml/util/POIXMLConstants.java index ab58e35833..c6d7935fda 100644 --- a/src/ooxml/java/org/apache/poi/ooxml/util/POIXMLConstants.java +++ b/src/ooxml/java/org/apache/poi/ooxml/util/POIXMLConstants.java @@ -20,6 +20,7 @@ package org.apache.poi.ooxml.util; public class POIXMLConstants { public static final String FEATURE_LOAD_DTD_GRAMMAR = "http://apache.org/xml/features/nonvalidating/load-dtd-grammar"; public static final String FEATURE_LOAD_EXTERNAL_DTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; + public static final String FEATURE_DISALLOW_DOCTYPE_DECL = "http://apache.org/xml/features/disallow-doctype-decl"; public static final String PROPERTY_ENTITY_EXPANSION_LIMIT = "http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit"; public static final String PROPERTY_SECURITY_MANAGER = "http://apache.org/xml/properties/security-manager"; } -- 2.39.5