authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-05-05 10:46:21+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-05 12:37:04-04:00
log18b46485bcb6ad6b4be31c87659ffd78a311c904
tree8d62c1a25260a1833f82b77ec82e8d454531408a
parent622a3ac876a6eac17b768625350326e9ff121f4e

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.

1 files changed, 0 insertions(+), 1 deletions(-)

src/Compilation.zig-1
...@@ -232,7 +232,6 @@ pub const CObject = struct {...@@ -232,7 +232,6 @@ pub const CObject = struct {
232 pub fn destroy(em: *ErrorMsg, gpa: *Allocator) void {232 pub fn destroy(em: *ErrorMsg, gpa: *Allocator) void {
233 gpa.free(em.msg);233 gpa.free(em.msg);
234 gpa.destroy(em);234 gpa.destroy(em);
235 em.* = undefined;
236 }235 }
237 };236 };
238237