[all-commits] [llvm/llvm-project] 8e7ae3: [llvm-objcopy] Avoid invalid Sec.Offset after D79229

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun May 3 22:07:18 PDT 2020


  Branch: refs/heads/release/10.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 8e7ae355ba97d6ac0020e11a0efeddc454b9f933
      https://github.com/llvm/llvm-project/commit/8e7ae355ba97d6ac0020e11a0efeddc454b9f933
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-05-03 (Sun, 03 May 2020)

  Changed paths:
    M llvm/tools/llvm-objcopy/ELF/Object.cpp

  Log Message:
  -----------
  [llvm-objcopy] Avoid invalid Sec.Offset after D79229

To avoid undefined behavior caught by -fsanitize=undefined on binary-paddr.test

  void SectionWriter::visit(const Section &Sec) {
    if (Sec.Type != SHT_NOBITS)
      // Sec.Contents is empty while Sec.Offset may be out of bound
      llvm::copy(Sec.Contents, Out.getBufferStart() + Sec.Offset);
  }

(cherry picked from commit 762fb1c40eea6878c2d6a1f0f1fc7915c8747981)




More information about the All-commits mailing list