[PATCH] D95510: Diagnose if a SLEB128 is too large to fit in an int64_t.

Richard Smith - zygoloid via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 23:52:15 PST 2021


rsmith created this revision.
rsmith added reviewers: dblaikie, aardappel.
Herald added subscribers: dexonsmith, sunfish, hiraditya, sbc100.
rsmith requested review of this revision.
Herald added a subscriber: aheejin.
Herald added a project: LLVM.

Previously we'd hit UB due to an invalid left shift operand.

Also fix the WASM emitter to properly use SLEB128 encoding instead of
ULEB128 encoding for signed fields so that negative numbers don't
result in overly-large values that we can't read back any more.

In passing, don't diagnose a non-canonical ULEB128 that fits in a uint64_t but
has redundant trailing zero bytes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95510

Files:
  llvm/include/llvm/Support/LEB128.h
  llvm/lib/ObjectYAML/WasmEmitter.cpp
  llvm/unittests/Support/LEB128Test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95510.319478.patch
Type: text/x-patch
Size: 6432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210127/13b2e59e/attachment.bin>


More information about the llvm-commits mailing list