additional safety belts to handle broken files
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1187647 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f428ff6a57
commit
2ed5482fbf
@ -158,11 +158,15 @@ public class VariantSupport extends Variant
|
|||||||
TypedPropertyValue typedPropertyValue = new TypedPropertyValue(
|
TypedPropertyValue typedPropertyValue = new TypedPropertyValue(
|
||||||
(int) type, null );
|
(int) type, null );
|
||||||
int unpadded;
|
int unpadded;
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
unpadded = typedPropertyValue.readValue( src, offset );
|
unpadded = typedPropertyValue.readValue( src, offset );
|
||||||
} catch (UnsupportedOperationException exc) {
|
}
|
||||||
final byte[] v = new byte[length];
|
catch ( UnsupportedOperationException exc )
|
||||||
System.arraycopy( src, offset, v, 0, length );
|
{
|
||||||
|
int propLength = Math.min( length, src.length - offset );
|
||||||
|
final byte[] v = new byte[propLength];
|
||||||
|
System.arraycopy( src, offset, v, 0, propLength );
|
||||||
throw new ReadingNotSupportedException( type, v );
|
throw new ReadingNotSupportedException( type, v );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user