authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-25 12:15:58-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-25 12:23:21-04:00
loged00afbc4c1eec6d599ac277e364b4a1ed11fe5c
treefac5782379f1d0d6b88cb63fd258780a9fd7a0f7
parent868d5925809a4b97472dbfb9e32d73391f4d1ffa

Coff: fix use after free


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

src/link/Coff.zig+1-2
...@@ -1461,7 +1461,6 @@ pub fn updateDeclExports(...@@ -1461,7 +1461,6 @@ pub fn updateDeclExports(
1461 const decl = mod.declPtr(decl_index);1461 const decl = mod.declPtr(decl_index);
1462 const atom_index = try self.getOrCreateAtomForDecl(decl_index);1462 const atom_index = try self.getOrCreateAtomForDecl(decl_index);
1463 const atom = self.getAtom(atom_index);1463 const atom = self.getAtom(atom_index);
1464 const decl_sym = atom.getSymbol(self);
1465 const decl_metadata = self.decls.getPtr(decl_index).?;1464 const decl_metadata = self.decls.getPtr(decl_index).?;
14661465
1467 for (exports) |exp| {1466 for (exports) |exp| {
...@@ -1505,7 +1504,7 @@ pub fn updateDeclExports(...@@ -1505,7 +1504,7 @@ pub fn updateDeclExports(
1505 const sym_loc = SymbolWithLoc{ .sym_index = sym_index, .file = null };1504 const sym_loc = SymbolWithLoc{ .sym_index = sym_index, .file = null };
1506 const sym = self.getSymbolPtr(sym_loc);1505 const sym = self.getSymbolPtr(sym_loc);
1507 try self.setSymbolName(sym, mod.intern_pool.stringToSlice(exp.opts.name));1506 try self.setSymbolName(sym, mod.intern_pool.stringToSlice(exp.opts.name));
1508 sym.value = decl_sym.value;1507 sym.value = atom.getSymbol(self).value;
1509 sym.section_number = @as(coff.SectionNumber, @enumFromInt(self.text_section_index.? + 1));1508 sym.section_number = @as(coff.SectionNumber, @enumFromInt(self.text_section_index.? + 1));
1510 sym.type = .{ .complex_type = .FUNCTION, .base_type = .NULL };1509 sym.type = .{ .complex_type = .FUNCTION, .base_type = .NULL };
15111510