properly fulfill InputStream's contract
@@ -70,6 +70,9 @@ public synchronized int read(final byte[] b, final int off, int len) throws IOEx
if (len <= 0) {
return 0;
}
+ if (off < 0 || len > b.length - off) {
+ throw new IllegalArgumentException("offset or len are out of bounds");
+ }
if (len > end - loc) {
if (loc >= end) {
