You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2015/05/11 22:00:42 UTC

svn commit: r1678812 - /poi/trunk/src/java/org/apache/poi/ddf/EscherPropertyFactory.java

Author: centic
Date: Mon May 11 20:00:42 2015
New Revision: 1678812

URL: http://svn.apache.org/r1678812
Log:
Provide better exception if we would access out of bounds in arraycopy for Escher properties

Modified:
    poi/trunk/src/java/org/apache/poi/ddf/EscherPropertyFactory.java

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherPropertyFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherPropertyFactory.java?rev=1678812&r1=1678811&r2=1678812&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherPropertyFactory.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherPropertyFactory.java Mon May 11 20:00:42 2015
@@ -82,7 +82,14 @@ public final class EscherPropertyFactory
                     pos += ((EscherArrayProperty)p).setArrayData(data, pos);
                 } else {
                     byte[] complexData = ((EscherComplexProperty)p).getComplexData();
-                    System.arraycopy(data, pos, complexData, 0, complexData.length);
+
+                    int leftover = data.length-pos;
+					if(leftover < complexData.length){
+                    	throw new IllegalStateException("Could not read complex escher property, lenght was " + complexData.length + ", but had only " +
+                    			leftover + " bytes left");
+                    }
+
+					System.arraycopy(data, pos, complexData, 0, complexData.length);
                     pos += complexData.length;
                 }
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org