[all-commits] [llvm/llvm-project] bb9461: [COFF] Check table ptr more thoroughly and ignore ...

alvinhochun via All-commits all-commits at lists.llvm.org
Fri Jun 3 08:31:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb94611d6545c2c5271f5bb01de1aa4228a37250
      https://github.com/llvm/llvm-project/commit/bb94611d6545c2c5271f5bb01de1aa4228a37250
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M llvm/include/llvm/Object/COFF.h
    M llvm/include/llvm/Object/Error.h
    M llvm/lib/Object/COFFObjectFile.cpp
    M llvm/lib/Object/Error.cpp
    A llvm/test/Object/Inputs/COFF/dwarf-debug-only.yaml
    A llvm/test/Object/coff-dwarf-debug-only.test
    M llvm/tools/llvm-objdump/COFFDump.cpp

  Log Message:
  -----------
  [COFF] Check table ptr more thoroughly and ignore empty sections

When loading split debug files for PE/COFF executables (produced with
`objcopy --only-keep-debug`), the tables or directories in such files
may point to data inside sections that may have been stripped.
COFFObjectFile shall detect and gracefully handle this, to allow the
object file be loaded without considering these tables or directories.
This is required for LLDB to load these files for use as debug symbols.

COFFObjectFile shall also check these pointers more carefully to account
for cases in which the section contains less raw data than the size
given by VirtualSize, to prevent going out of bounds.

This commit also changes COFFDump in llvm-objdump to reuse the pointers
that are already range-checked in COFFObjectFile. This fixes a crash
when trying to dump the TLS directory from a stripped file.

Fixes https://github.com/mstorsjo/llvm-mingw/issues/284

Reviewed By: rnk

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




More information about the All-commits mailing list