mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-24 04:54:40 +02:00
6888149: AtomicReferenceArray causes SIGSEGV -> SEGV_MAPERR error
Avoid integer overflow by using long arithmetic Reviewed-by: martin, dholmes
This commit is contained in:
parent
c09da77c87
commit
9ae7ce5ffe
3 changed files with 3 additions and 3 deletions
|
@ -57,7 +57,7 @@ public class AtomicIntegerArray implements java.io.Serializable {
|
||||||
private long rawIndex(int i) {
|
private long rawIndex(int i) {
|
||||||
if (i < 0 || i >= array.length)
|
if (i < 0 || i >= array.length)
|
||||||
throw new IndexOutOfBoundsException("index " + i);
|
throw new IndexOutOfBoundsException("index " + i);
|
||||||
return base + i * scale;
|
return base + (long) i * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class AtomicLongArray implements java.io.Serializable {
|
||||||
private long rawIndex(int i) {
|
private long rawIndex(int i) {
|
||||||
if (i < 0 || i >= array.length)
|
if (i < 0 || i >= array.length)
|
||||||
throw new IndexOutOfBoundsException("index " + i);
|
throw new IndexOutOfBoundsException("index " + i);
|
||||||
return base + i * scale;
|
return base + (long) i * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class AtomicReferenceArray<E> implements java.io.Serializable {
|
||||||
private long rawIndex(int i) {
|
private long rawIndex(int i) {
|
||||||
if (i < 0 || i >= array.length)
|
if (i < 0 || i >= array.length)
|
||||||
throw new IndexOutOfBoundsException("index " + i);
|
throw new IndexOutOfBoundsException("index " + i);
|
||||||
return base + i * scale;
|
return base + (long) i * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue