diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-11-16 17:44:19 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-11-16 17:44:19 +0100 |
commit | e41cf8511f68e7e67786d8735d03c961c34cb2ad (patch) | |
tree | d6affde54a389e93abf044f52c2b2b4b2c656e21 /src/libexpr | |
parent | 8c93a481af2ce8fbcdb9e2bbcc9559d52703112f (diff) |
Don't hang when calling an attrset
Fixes #5565.
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/eval.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 402de78ad..615f020e4 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -1275,6 +1275,8 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value & } }; + Attr * functor; + while (nrArgs > 0) { if (vCur.isLambda()) { @@ -1403,16 +1405,14 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value & } } - else if (vCur.type() == nAttrs) { - if (auto functor = vCur.attrs->get(sFunctor)) { - /* 'vCur" may be allocated on the stack of the calling - function, but for functors we may keep a reference, - so heap-allocate a copy and use that instead. */ - Value * args2[] = {allocValue()}; - *args2[0] = vCur; - /* !!! Should we use the attr pos here? */ - callFunction(*functor->value, 1, args2, vCur, pos); - } + else if (vCur.type() == nAttrs && (functor = vCur.attrs->get(sFunctor))) { + /* 'vCur" may be allocated on the stack of the calling + function, but for functors we may keep a reference, so + heap-allocate a copy and use that instead. */ + Value * args2[] = {allocValue()}; + *args2[0] = vCur; + /* !!! Should we use the attr pos here? */ + callFunction(*functor->value, 1, args2, vCur, pos); } else |