Commit 01b48e9381

Carl Åstholm <carl@astholm.se>
2024-01-07 21:39:22
InternPool: Fix rare buffer overflow when initializing aggregate with sentinel
1 parent 9245809
Changed files (1)
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,