diff options
author | Silvan Mosberger <contact@infinisil.com> | 2020-09-11 19:21:40 +0200 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2020-09-11 20:41:51 +0200 |
commit | 8dbd57a6a5fe497bde9e647a3249c1ce0ea121ab (patch) | |
tree | 07f0491f1f687f917c5d9bd19283e03de7c1f808 /src/libexpr/eval.cc | |
parent | e1f2c93f889459aa92689636829dc8ea257b5c73 (diff) |
Fix auto argument passing for more auto arguments than formals
The change in 626200713bb3cc844a9feb6af583c9b6b42c6dbc didn't account
for when the number of auto arguments is bigger than the number of
formal arguments. This causes the following:
$ nix-instantiate --eval -E '{ ... }@args: args.foo' --argstr foo foo
nix-instantiate: src/libexpr/attr-set.hh:55: void nix::Bindings::push_back(const nix::Attr&): Assertion `size_ < capacity_' failed.
Aborted (core dumped)
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r-- | src/libexpr/eval.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 8c97b3760..dab11ce45 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -1348,7 +1348,7 @@ void EvalState::autoCallFunction(Bindings & args, Value & fun, Value & res) } Value * actualArgs = allocValue(); - mkAttrs(*actualArgs, fun.lambda.fun->formals->formals.size()); + mkAttrs(*actualArgs, std::max(static_cast<uint32_t>(fun.lambda.fun->formals->formals.size()), args.size())); if (fun.lambda.fun->formals->ellipsis) { // If the formals have an ellipsis (eg the function accepts extra args) pass |