Merge pull request #14789 from jacobly0/ditype

llvm: fix use after free with pointers to optional slices
This commit is contained in:
Andrew Kelley
2023-03-05 16:32:51 -05:00
committed by GitHub
2 changed files with 21 additions and 1 deletions

View File

@@ -1773,7 +1773,7 @@ pub const Object = struct {
if (ty.optionalReprIsPayload()) {
const ptr_di_ty = try o.lowerDebugType(child_ty, resolve);
// The recursive call to `lowerDebugType` means we can't use `gop` anymore.
try o.di_type_map.putContext(gpa, ty, AnnotatedDITypePtr.initFull(ptr_di_ty), .{ .mod = o.module });
try o.di_type_map.putContext(gpa, ty, AnnotatedDITypePtr.init(ptr_di_ty, resolve), .{ .mod = o.module });
return ptr_di_ty;
}