8294593: Check the size of the target on invocations of BigInteger::isProbablePrime

Reviewed-by: darcy
This commit is contained in:
Raffaello Giulietti 2022-10-03 18:02:21 +00:00
parent a4f2078bd6
commit 081691adf4
2 changed files with 24 additions and 3 deletions

View file

@ -3889,7 +3889,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
return true;
if (!w.testBit(0) || w.equals(ONE))
return false;
if (w.bitLength() > PRIME_SEARCH_BIT_LENGTH_LIMIT + 1) {
throw new ArithmeticException("Primality test implementation restriction on bitLength");
}
return w.primeToCertainty(certainty, null);
}