Commit a39c51c6a4

Andrew Kelley <andrew@ziglang.org>
2022-07-16 22:48:12
Sema: fix UAF in coerceInMemoryAllowed
1 parent 47c58cb
Changed files (1)
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),
             } };
         }