about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKane York <kanepyork@gmail.com>2020-09-12T15·39-0700
committerkanepyork <rikingcoding@gmail.com>2020-09-15T21·42+0000
commitd9c7f32a9c8644acef4569509be0de8f1c82ff6c (patch)
treebbce6e87665a9fb3f6356efd0495de2e4e543511
parent2c19bd666280c33eb63d3f3b9063b07b62023c9d (diff)
fix(3p/tvix): properly zero the largest member of Value r/1793
The static_assert is present to force us to change the constructor when a member grows.

Change-Id: Ifa4f4a03eb7ce13cff109cf26ecf0032045905e9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1972
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
-rw-r--r--third_party/nix/src/libexpr/value.hh5
1 files changed, 4 insertions, 1 deletions
diff --git a/third_party/nix/src/libexpr/value.hh b/third_party/nix/src/libexpr/value.hh
index b5a1a33cba..980d9affbb 100644
--- a/third_party/nix/src/libexpr/value.hh
+++ b/third_party/nix/src/libexpr/value.hh
@@ -105,7 +105,10 @@ struct Value {
     NixFloat fpoint;
   };
 
-  Value() : type(tInt), integer(0) {}
+  Value() : type(tInt), attrs(nullptr) {
+    static_assert(offsetof(Value, attrs) + sizeof(attrs) == sizeof(Value));
+  }
+
   Value(const Value& copy);
   Value(Value&& move);
   ~Value() {}