From e4b2f3054a77ec28d501e269affbac6cfdfda35c Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 31 Aug 2021 07:04:31 -0400 Subject: [WebAssembly][libObject] Avoid re-use of Section object during parsing The re-use of this struct across iterations of the loop was causing fields (specifically Name) to be incorrectly shared between multiple sections. Differential Revision: https://reviews.llvm.org/D108984 --- llvm/lib/Object/WasmObjectFile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Object/WasmObjectFile.cpp') diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index a08c648..9a4e246 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -286,9 +286,9 @@ WasmObjectFile::WasmObjectFile(MemoryBufferRef Buffer, Error &Err) return; } - WasmSection Sec; WasmSectionOrderChecker Checker; while (Ctx.Ptr < Ctx.End) { + WasmSection Sec; if ((Err = readSection(Sec, Ctx, Checker))) return; if ((Err = parseSection(Sec))) -- cgit v1.1