Guard against overflow in fjbg. Closes #3671, no review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23033 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
edf78d7483
commit
c2298a9720
BIN
lib/fjbg.jar
BIN
lib/fjbg.jar
Binary file not shown.
|
|
@ -575,12 +575,13 @@ public class JExtendedCode extends JCode {
|
|||
}
|
||||
|
||||
int keyMin = keys[0], keyMax = keys[keys.length - 1];
|
||||
int keyRange = keyMax - keyMin + 1;
|
||||
/** Calculate in long to guard against overflow. */
|
||||
long keyRange = (long)keyMax - keyMin + 1;
|
||||
if ((double)keys.length / (double)keyRange >= minDensity) {
|
||||
// Keys are dense enough, use a table in which holes are
|
||||
// filled with defaultBranch.
|
||||
int[] newKeys = new int[keyRange];
|
||||
Label[] newBranches = new Label[keyRange];
|
||||
int[] newKeys = new int[(int)keyRange];
|
||||
Label[] newBranches = new Label[(int)keyRange];
|
||||
int oldPos = 0;
|
||||
for (int i = 0; i < keyRange; ++i) {
|
||||
int key = keyMin + i;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
object Crash {
|
||||
def crash(value: Int): Unit =
|
||||
value match {
|
||||
case java.lang.Integer.MAX_VALUE => println("MAX_VALUE")
|
||||
case java.lang.Integer.MIN_VALUE => println("MIN_VALUE")
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue