diff options
author | Heejin Ahn <aheejin@gmail.com> | 2021-03-30 12:57:20 -0700 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2021-03-30 16:21:58 -0700 |
commit | 144ec1c38ef1d3a6d37dadf7240ef5f04c10daae (patch) | |
tree | cf4d5060fda5185329a0ad137d76f3e5fcb91951 /llvm/lib/Object/WasmObjectFile.cpp | |
parent | c5f174905b73620cf8690dbe68ea05b29d09f4a1 (diff) | |
download | llvm-144ec1c38ef1d3a6d37dadf7240ef5f04c10daae.zip llvm-144ec1c38ef1d3a6d37dadf7240ef5f04c10daae.tar.gz llvm-144ec1c38ef1d3a6d37dadf7240ef5f04c10daae.tar.bz2 |
[WebAssembly] Encode numbers in ULEB128 in event section
The number of events and the type index should be encoded in ULEB128,
but they were incorrctly encoded in LEB128. The smallest number with
which its LEB128 and ULEB128 encodings are different is 64.
There's no way we can generate 64 events in the C++ toolchain
implementation so we can't test that, but the attached test tests when
the type index is 64.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D99627
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index f759a61..b7bf770 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -1134,13 +1134,13 @@ Error WasmObjectFile::parseMemorySection(ReadContext &Ctx) { Error WasmObjectFile::parseEventSection(ReadContext &Ctx) { EventSection = Sections.size(); - uint32_t Count = readVarint32(Ctx); + uint32_t Count = readVaruint32(Ctx); Events.reserve(Count); while (Count--) { wasm::WasmEvent Event; Event.Index = NumImportedEvents + Events.size(); Event.Type.Attribute = readVaruint32(Ctx); - Event.Type.SigIndex = readVarint32(Ctx); + Event.Type.SigIndex = readVaruint32(Ctx); Events.push_back(Event); } |