about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPuck Meerburg <puck@puckipedia.com>2019-11-25T12·37+0000
committerEelco Dolstra <edolstra@gmail.com>2020-01-04T13·12+0100
commit59bbc3170105a42cf1c49bee64321157eb3a01d4 (patch)
tree5cba790cad7ea857bf9487dee3d0919a4d88639c
parent195cc3f883f2694f96c627301ef13ebdfbddb5cf (diff)
Ensure enough space in attrset bindings when using both __overrides and dynamic attributes
(cherry picked from commit cd55f91ad2075d5ebb506950dfbc4161cab22db5)
-rw-r--r--src/libexpr/eval.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index d84d0dd1612f..dc2520229381 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -877,7 +877,7 @@ void ExprAttrs::eval(EvalState & state, Env & env, Value & v)
         if (hasOverrides) {
             Value * vOverrides = (*v.attrs)[overrides->second.displ].value;
             state.forceAttrs(*vOverrides);
-            Bindings * newBnds = state.allocBindings(v.attrs->size() + vOverrides->attrs->size());
+            Bindings * newBnds = state.allocBindings(v.attrs->capacity() + vOverrides->attrs->size());
             for (auto & i : *v.attrs)
                 newBnds->push_back(i);
             for (auto & i : *vOverrides->attrs) {