[PATCH] D126898: [COFF] Check table ptr more thoroughly and ignore empty sections
Alvin Wong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 10:41:55 PDT 2022
alvinhochun created this revision.
Herald added subscribers: mstorsjo, rupprecht, hiraditya.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added a project: All.
alvinhochun published this revision for review.
alvinhochun added reviewers: mstorsjo, rnk.
Herald added subscribers: llvm-commits, StephenFan.
Herald added a project: LLVM.
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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126898
Files:
llvm/include/llvm/Object/COFF.h
llvm/include/llvm/Object/Error.h
llvm/lib/Object/COFFObjectFile.cpp
llvm/lib/Object/Error.cpp
llvm/test/Object/Inputs/COFF/dwarf-debug-only.yaml
llvm/test/Object/coff-dwarf-debug-only.test
llvm/tools/llvm-objdump/COFFDump.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126898.433793.patch
Type: text/x-patch
Size: 15278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220602/99394e7b/attachment.bin>
More information about the llvm-commits
mailing list