From a39c51c6a44fd6d8e3a5e82bcfd2db61c8972ea6 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 16 Jul 2022 13:48:12 -0700 Subject: [PATCH] Sema: fix UAF in coerceInMemoryAllowed --- src/Sema.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index bb306976ea..c64135f559 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -21246,8 +21246,8 @@ fn coerceInMemoryAllowed( if (child != .ok) { return InMemoryCoercionResult{ .optional_child = .{ .child = try child.dupe(sema.arena), - .actual = src_child_type, - .wanted = dest_child_type, + .actual = try src_child_type.copy(sema.arena), + .wanted = try dest_child_type.copy(sema.arena), } }; }