From 90d6018509e60fd07d93ddefbf6f983a72d4b587 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 2 Oct 2019 22:08:19 +0200 Subject: [PATCH] Fix aborts when using builtins.getFlake In that case, 'self' could refer to a value on the stack, so accessing 'self.rev' would abort. --- src/libexpr/flake/flake.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index 2061a34a4..9e260263c 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -574,8 +574,9 @@ static void prim_callFlake(EvalState & state, const Pos & pos, Value * * args, V void callFlake(EvalState & state, const Flake & flake, const LockedInputs & lockedInputs, - Value & vRes) + Value & vResFinal) { + auto & vRes = *state.allocValue(); auto & vInputs = *state.allocValue(); state.mkAttrs(vInputs, flake.inputs.size() + 1); @@ -617,6 +618,8 @@ void callFlake(EvalState & state, state.callFunction(vCall, *flake.vOutputs, vCall2, noPos); state.callFunction(vCall2, vInputs, vCall3, noPos); state.callFunction(vCall3, vSourceInfo, vRes, noPos); + + vResFinal = vRes; } void callFlake(EvalState & state,