poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1678812 - /poi/trunk/src/java/org/apache/poi/ddf/EscherPropertyFactory.java
Date Mon, 11 May 2015 20:00:42 GMT
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


Mime
View raw message