[all-commits] [llvm/llvm-project] d060cc: [ELF] Fix out-of-bounds write in memset(&Out::firs...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Nov 28 14:48:10 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d060cc1f9808dd5de524334fd695404a96e3175f
      https://github.com/llvm/llvm-project/commit/d060cc1f9808dd5de524334fd695404a96e3175f
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-11-28 (Sun, 28 Nov 2021)

  Changed paths:
    M lld/ELF/Driver.cpp
    M lld/ELF/OutputSections.cpp
    M lld/ELF/OutputSections.h
    M lld/ELF/Writer.cpp

  Log Message:
  -----------
  [ELF] Fix out-of-bounds write in memset(&Out::first, ...)

Fix r285764: there is no guarantee that Out::first is placed before other
static data members of `struct Out`. After `bufferStart` was introduced, this
out-of-bounds write is destined in many compilers. It is likely benign, though.

And move `Out::elfHeader->size` assignment beside `Out::elfHeader->sectionIndex`




More information about the All-commits mailing list