wasm-linker: fix use of invalidated memory in populateErrorNameTable
This commit is contained in:
@@ -3005,7 +3005,6 @@ pub fn getErrorTableSymbol(wasm: *Wasm) !u32 {
|
||||
fn populateErrorNameTable(wasm: *Wasm) !void {
|
||||
const symbol_index = wasm.error_table_symbol orelse return;
|
||||
const atom_index = wasm.symbol_atom.get(.{ .file = null, .index = symbol_index }).?;
|
||||
const atom = wasm.getAtomPtr(atom_index);
|
||||
|
||||
// Rather than creating a symbol for each individual error name,
|
||||
// we create a symbol for the entire region of error names. We then calculate
|
||||
@@ -3030,6 +3029,8 @@ fn populateErrorNameTable(wasm: *Wasm) !void {
|
||||
var addend: u32 = 0;
|
||||
const mod = wasm.base.options.module.?;
|
||||
for (mod.global_error_set.keys()) |error_name_nts| {
|
||||
const atom = wasm.getAtomPtr(atom_index);
|
||||
|
||||
const error_name = mod.intern_pool.stringToSlice(error_name_nts);
|
||||
const len = @as(u32, @intCast(error_name.len + 1)); // names are 0-termianted
|
||||
|
||||
|
||||
Reference in New Issue
Block a user