aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WasmObjectFile.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2021-08-31 07:04:31 -0400
committerSam Clegg <sbc@chromium.org>2021-09-10 09:30:50 -0400
commite4b2f3054a77ec28d501e269affbac6cfdfda35c (patch)
tree99fa04b5d91b4da72b201c6134e955950605800c /llvm/lib/Object/WasmObjectFile.cpp
parent4a25c3fb61942c629907ae50462087c3fbb8703a (diff)
downloadllvm-e4b2f3054a77ec28d501e269affbac6cfdfda35c.zip
llvm-e4b2f3054a77ec28d501e269affbac6cfdfda35c.tar.gz
llvm-e4b2f3054a77ec28d501e269affbac6cfdfda35c.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp2
1 files changed, 1 insertions, 1 deletions
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)))