Skip to content

Commit 6ccf35e

Browse files
committed
Add check for negative offset
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1300370 13f79535-47bb-0310-9956-ffa450edef68
1 parent 87dfbd9 commit 6ccf35e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/org/apache/commons/io/input/CharSequenceReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public int read(char[] array, int offset, int length) {
104104
if (array == null) {
105105
throw new NullPointerException("Character array is missing");
106106
}
107-
if (length < 0 || (offset + length) > array.length) {
107+
if (length < 0 || offset < 0 || (offset + length) > array.length) {
108108
throw new IndexOutOfBoundsException("Array Size=" + array.length +
109109
", offset=" + offset + ", length=" + length);
110110
}

0 commit comments

Comments
 (0)