Skip to content

Commit

Permalink
Fix integer overflow leading to out-of-bounds read/write
Browse files Browse the repository at this point in the history
  • Loading branch information
polivar3 authored and dicej committed Oct 27, 2020
1 parent 9bbd495 commit 0871979
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion classpath/java/io/FileOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void write(byte[] b, int offset, int length) throws IOException {
throw new NullPointerException();
}

if (offset < 0 || offset + length > b.length) {
if (offset < 0 || length < 0 || length > b.length || offset > b.length - length) {
throw new ArrayIndexOutOfBoundsException();
}

Expand Down

0 comments on commit 0871979

Please sign in to comment.