From edf18aa383cc5553a51e57954cf7e076c4b745db Mon Sep 17 00:00:00 2001 From: Matthew Lugg Date: Mon, 24 Aug 2026 08:48:42 +0100 Subject: [PATCH] Elf2: do not assume nodes are initialized to zero This is not a guarantee of the `MappedFile` interface, because guaranteeing it can be inefficient. Right now it will usually be the case, but that may not hold in the future. --- src/link/Elf2.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/link/Elf2.zig b/src/link/Elf2.zig index a6987c98db982537ea3f32da79d72d0de1f9fc18..8ef617fad2e1cc2d4c7a67412a714502d4e8e2f6 100644 --- a/src/link/Elf2.zig +++ b/src/link/Elf2.zig @@ -4249,8 +4249,8 @@ fn initHeaders( if (elf.targetEndian() != std.lang.Endian.native) { std.mem.byteSwapAllFields(info.Header(), header); } - // The initial bucket and chain values are all 0, but `MappedFile` initialized - // the node with zeroes anyway, so no need to memset. + // The initial bucket and chain values are all 0. + @memset(hash_slice[@sizeOf(info.Header())..], 0); }, } -- 2.54.0