You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2013/05/29 19:31:50 UTC
svn commit: r1487558 -
/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java
Author: nick
Date: Wed May 29 17:31:50 2013
New Revision: 1487558
URL: http://svn.apache.org/r1487558
Log:
More on bug #54682 - check for the end offset overflowing too
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java?rev=1487558&r1=1487557&r2=1487558&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java Wed May 29 17:31:50 2013
@@ -34,10 +34,12 @@ public final class UnhandledDataStructur
public UnhandledDataStructure(byte[] buf, int offset, int length)
{
// Sanity check the size they've asked for
- if (offset + length > buf.length)
+ int offsetEnd = offset + length;
+ if (offsetEnd > buf.length || offsetEnd < 0)
{
throw new IndexOutOfBoundsException("Buffer Length is " + buf.length + " " +
- "but code is tried to read " + length + " from offset " + offset);
+ "but code is tried to read " + length + " " +
+ "from offset " + offset + " to " + offsetEnd);
}
if (offset < 0 || length < 0)
{
@@ -46,7 +48,7 @@ public final class UnhandledDataStructur
}
// Save that requested portion of the data
- _buf = Arrays.copyOfRange(buf, offset, offset + length);
+ _buf = Arrays.copyOfRange(buf, offset, offsetEnd);
}
byte[] getBuf()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org