mirror of https://github.com/apache/poi.git
Provide better exception if we would access out of bounds in arraycopy for Escher properties
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1678812 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
43710ae5f2
commit
51acceca48
|
@ -82,7 +82,14 @@ public final class EscherPropertyFactory {
|
||||||
pos += ((EscherArrayProperty)p).setArrayData(data, pos);
|
pos += ((EscherArrayProperty)p).setArrayData(data, pos);
|
||||||
} else {
|
} else {
|
||||||
byte[] complexData = ((EscherComplexProperty)p).getComplexData();
|
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;
|
pos += complexData.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue