From 01b48e938198a206b95ed06f3a7e530e859c1cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20=C3=85stholm?= Date: Sun, 7 Jan 2024 21:39:22 +0100 Subject: [PATCH] InternPool: Fix rare buffer overflow when initializing aggregate with sentinel --- src/InternPool.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/InternPool.zig b/src/InternPool.zig index 2e690652a3..0844e0f7a5 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -5315,7 +5315,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { try ip.extra.ensureUnusedCapacity( gpa, - @typeInfo(Tag.Aggregate).Struct.fields.len + @as(usize, @intCast(len_including_sentinel)), + @typeInfo(Tag.Aggregate).Struct.fields.len + @as(usize, @intCast(len_including_sentinel + 1)), ); ip.items.appendAssumeCapacity(.{ .tag = .aggregate,