InternPool: Fix rare buffer overflow when initializing aggregate with sentinel

This commit is contained in:
Carl Åstholm 2024-01-07 21:39:22 +01:00
parent 92458094c8
commit 01b48e9381

View File

@ -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,