Skip to content

Commit

Permalink
[GR-18188] Backport: SVM's arraycopy hard-crashes with large indices,…
Browse files Browse the repository at this point in the history
… bounds-check is incorrect.
  • Loading branch information
ezzarghili committed Sep 12, 2019
2 parents 116e4e4 + e03c2ae commit 70f5e3c
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -104,7 +104,7 @@ private static void doArraycopy(Object fromArray, int fromIndex, Object toArray,
}

private static void boundsCheck(Object fromArray, int fromIndex, Object toArray, int toIndex, int length) {
if (fromIndex < 0 || toIndex < 0 || length < 0 || fromIndex + length > KnownIntrinsics.readArrayLength(fromArray) || toIndex + length > KnownIntrinsics.readArrayLength(toArray)) {
if (fromIndex < 0 || toIndex < 0 || length < 0 || fromIndex > KnownIntrinsics.readArrayLength(fromArray) - length || toIndex > KnownIntrinsics.readArrayLength(toArray) - length) {
throw new IndexOutOfBoundsException();
}
}
Expand Down

0 comments on commit 70f5e3c

Please sign in to comment.