Skip to content

Commit 54e36bb

Browse files
committed
Check for too many positional params, fix #180
1 parent bb0e032 commit 54e36bb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/vm.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,12 @@ class Interpreter {
11391139
<< i;
11401140
throw makeError(ast.location, ss.str());
11411141
}
1142+
if (i >= func->params.size()) {
1143+
std::stringstream ss;
1144+
ss << "Too many args, function has " << func->params.size()
1145+
<< " parameter(s)";
1146+
throw makeError(ast.location, ss.str());
1147+
}
11421148
name = func->params[i].id;
11431149
}
11441150
// Special case for builtin functions -- leave identifier blank for

0 commit comments

Comments
 (0)