add size check in get_argument_vector

This commit is contained in:
pantor
2021-01-16 15:38:14 +01:00
parent 3cc82e934e
commit 316567898e
+4
View File
@@ -119,6 +119,10 @@ class Renderer : public NodeVisitor {
template<bool throw_not_found=true>
Arguments get_argument_vector(size_t N, const AstNode& node) {
if (json_eval_stack.size() < N) {
throw_renderer_error("function needs " + std::to_string(N) + " variables, but has only found " + std::to_string(json_eval_stack.size()), node);
}
Arguments result {N};
for (size_t i = 0; i < N; i += 1) {
result[N - i - 1] = json_eval_stack.top();