提交 72659f74 编写于 作者: D dl

6888149: AtomicReferenceArray causes SIGSEGV -> SEGV_MAPERR error

Summary: Avoid integer overflow by using long arithmetic
Reviewed-by: martin, dholmes
上级 70147f8d
......@@ -57,7 +57,7 @@ public class AtomicIntegerArray implements java.io.Serializable {
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;
}
/**
......
......@@ -56,7 +56,7 @@ public class AtomicLongArray implements java.io.Serializable {
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;
}
/**
......
......@@ -57,7 +57,7 @@ public class AtomicReferenceArray<E> implements java.io.Serializable {
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;
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册