6888149: AtomicReferenceArray causes SIGSEGV -> SEGV_MAPERR error
Summary: Avoid integer overflow by using long arithmetic
Reviewed-by: martin, dholmes
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Tue Nov 17 09:44:43 2009 +0000
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Tue Oct 06 12:20:35 2009 -0700
@@ -57,7 +57,7 @@
private long rawIndex(int i) {
if (i < 0 || i >= array.length)
throw new IndexOutOfBoundsException("index " + i);
- return base + i * scale;
+ return base + (long) i * scale;
}
/**
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Tue Nov 17 09:44:43 2009 +0000
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Tue Oct 06 12:20:35 2009 -0700
@@ -56,7 +56,7 @@
private long rawIndex(int i) {
if (i < 0 || i >= array.length)
throw new IndexOutOfBoundsException("index " + i);
- return base + i * scale;
+ return base + (long) i * scale;
}
/**
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Tue Nov 17 09:44:43 2009 +0000
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Tue Oct 06 12:20:35 2009 -0700
@@ -57,7 +57,7 @@
private long rawIndex(int i) {
if (i < 0 || i >= array.length)
throw new IndexOutOfBoundsException("index " + i);
- return base + i * scale;
+ return base + (long) i * scale;
}
/**