[all-commits] [llvm/llvm-project] 32e98f: Diagnose if a SLEB128 is too large to fit in an in...

Richard Smith via All-commits all-commits at lists.llvm.org
Tue Feb 2 14:34:00 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 32e98f05fe108e7b25dcf2031c499b96a1436e1d
      https://github.com/llvm/llvm-project/commit/32e98f05fe108e7b25dcf2031c499b96a1436e1d
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2021-02-02 (Tue, 02 Feb 2021)

  Changed paths:
    M llvm/include/llvm/Support/LEB128.h
    M llvm/lib/ObjectYAML/WasmEmitter.cpp
    M llvm/unittests/Support/LEB128Test.cpp

  Log Message:
  -----------
  Diagnose if a SLEB128 is too large to fit in an int64_t.

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.

Reviewed By: dblaikie, aardappel

Differential Revision: https://reviews.llvm.org/D95510




More information about the All-commits mailing list