From 18b46485bcb6ad6b4be31c87659ffd78a311c904 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 5 May 2021 10:46:21 +0200 Subject: [PATCH] stage2: Fix UAF in ErrorMsg destructor After calling gpa.destroy the object is gone for good, setting the contents to undefined is a bug and may crash the compiler. --- src/Compilation.zig | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Compilation.zig b/src/Compilation.zig index 7ff7ef1374..58d6f41858 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -232,7 +232,6 @@ pub const CObject = struct { pub fn destroy(em: *ErrorMsg, gpa: *Allocator) void { gpa.free(em.msg); gpa.destroy(em); - em.* = undefined; } };