diff --git a/prism/src/parser/ast/ModulesFile.java b/prism/src/parser/ast/ModulesFile.java index fd2a9168..3cd268ff 100644 --- a/prism/src/parser/ast/ModulesFile.java +++ b/prism/src/parser/ast/ModulesFile.java @@ -687,6 +687,10 @@ public class ModulesFile extends ASTElement String s = "Invalid range (" + low + "-" + high + ") for variable \"" + name + "\""; throw new PrismLangException(s, decl); } + if ((long)high - (long)low >= Integer.MAX_VALUE) { + String s = "Range for variable \"" + name + "\" (" + low + "-" + high + ") is too big"; + throw new PrismLangException(s, decl); + } // check start is valid if (start < low || start > high) { String s = "Invalid initial value (" + start + ") for variable \"" + name + "\""; @@ -720,6 +724,10 @@ public class ModulesFile extends ASTElement String s = "Invalid range (" + low + "-" + high + ") for variable \"" + name + "\""; throw new PrismLangException(s, decl); } + if ((long)high - (long)low >= Integer.MAX_VALUE) { + String s = "Range for variable \"" + name + "\" (" + low + "-" + high + ") is too big"; + throw new PrismLangException(s, decl); + } // check start is valid if (start < low || start > high) { String s = "Invalid initial value (" + start + ") for variable \"" + name + "\"";