https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/119723
Backport 5c8fd1eece8fff69871cef57a2363dc0f734a7d1 Requested by: @nikic >From fc310d328d3954207a775d0f0b17f9796912777a Mon Sep 17 00:00:00 2001 From: Sam Clegg <s...@chromium.org> Date: Mon, 9 Sep 2024 09:28:08 -0700 Subject: [PATCH] [lld][WebAssembly] Fix use of uninitialized stack data with --wasm64 (#107780) In the case of `--wasm64` we were setting the type of the init expression to be 64-bit but were only setting the low 32-bits of the value (by assigning to Int32). Fixes: https://github.com/emscripten-core/emscripten/issues/22538 (cherry picked from commit 5c8fd1eece8fff69871cef57a2363dc0f734a7d1) --- lld/wasm/SyntheticSections.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp index f02f55519a2512..72d08b849d8e86 100644 --- a/lld/wasm/SyntheticSections.cpp +++ b/lld/wasm/SyntheticSections.cpp @@ -587,8 +587,7 @@ void ElemSection::writeBody() { initExpr.Inst.Value.Global = WasmSym::tableBase->getGlobalIndex(); } else { bool is64 = config->is64.value_or(false); - initExpr.Inst.Opcode = is64 ? WASM_OPCODE_I64_CONST : WASM_OPCODE_I32_CONST; - initExpr.Inst.Value.Int32 = config->tableBase; + initExpr = intConst(config->tableBase, is64); } writeInitExpr(os, initExpr); _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits