diff options
author | Kane York <kanepyork@gmail.com> | 2020-09-12T15·39-0700 |
---|---|---|
committer | kanepyork <rikingcoding@gmail.com> | 2020-09-15T21·42+0000 |
commit | d9c7f32a9c8644acef4569509be0de8f1c82ff6c (patch) | |
tree | bbce6e87665a9fb3f6356efd0495de2e4e543511 /third_party | |
parent | 2c19bd666280c33eb63d3f3b9063b07b62023c9d (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>
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/nix/src/libexpr/value.hh | 5 |
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 b5a1a33cba45..980d9affbb51 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() {} |