Skip to content

Commit 0871979

Browse files
polivar3dicej
authored andcommitted
Fix integer overflow leading to out-of-bounds read/write
1 parent 9bbd495 commit 0871979

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

classpath/java/io/FileOutputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void write(byte[] b, int offset, int length) throws IOException {
5252
throw new NullPointerException();
5353
}
5454

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

0 commit comments

Comments
 (0)