Browse Source

ExpressionFunc.evaluatePowInt: guard against int underflow

master
Joachim Klein 8 years ago
parent
commit
9d0b038dda
  1. 3
      prism/src/parser/ast/ExpressionFunc.java

3
prism/src/parser/ast/ExpressionFunc.java

@ -355,6 +355,9 @@ public class ExpressionFunc extends Expression
// Check for overflow
if (res > Integer.MAX_VALUE)
throw new PrismLangException("Overflow evaluating integer power");
// Check for underflow
if (res < Integer.MIN_VALUE)
throw new PrismLangException("Underflow evaluating integer power");
return (int) res;
}

Loading…
Cancel
Save