You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/03/14 03:09:41 UTC
svn commit: r1300443 - in /commons/proper/io/trunk/src: changes/changes.xml
main/java/org/apache/commons/io/input/ReaderInputStream.java
Author: sebb
Date: Wed Mar 14 02:09:41 2012
New Revision: 1300443
URL: http://svn.apache.org/viewvc?rev=1300443&view=rev
Log:
IO-307 ReaderInputStream#read(byte[] b, int off, int len) should check for valid parameters
Modified:
commons/proper/io/trunk/src/changes/changes.xml
commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/ReaderInputStream.java
Modified: commons/proper/io/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/changes/changes.xml?rev=1300443&r1=1300442&r2=1300443&view=diff
==============================================================================
--- commons/proper/io/trunk/src/changes/changes.xml (original)
+++ commons/proper/io/trunk/src/changes/changes.xml Wed Mar 14 02:09:41 2012
@@ -40,6 +40,9 @@ The <action> type attribute can be add,u
<body>
<release version="2.2" date="TBA">
+ <action issue="IO-307" dev="sebb" type="fix">
+ ReaderInputStream#read(byte[] b, int off, int len) should check for valid parameters
+ </action>
<action issue="IO-287" dev="bayard" type="add" due-to="Ron Kuris, Gary Gregory">
Use terabyte (TB) , petabyte (PB) and exabyte (EB) in FileUtils.byteCountToDisplaySize(long size)
</action>
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/ReaderInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/ReaderInputStream.java?rev=1300443&r1=1300442&r2=1300443&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/ReaderInputStream.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/ReaderInputStream.java Wed Mar 14 02:09:41 2012
@@ -220,6 +220,13 @@ public class ReaderInputStream extends I
*/
@Override
public int read(byte[] b, int off, int len) throws IOException {
+ if (b == null) {
+ throw new NullPointerException("Byte array must not be null");
+ }
+ if (len < 0 || off < 0 || (off + len) > b.length) {
+ throw new IndexOutOfBoundsException("Array Size=" + b.length +
+ ", offset=" + off + ", length=" + len);
+ }
int read = 0;
if (len == 0) {
return 0; // Always return 0 if len == 0