[PATCH] D92098: [obj2yaml] - Don't crash when dumping an object with no sections.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 26 00:47:22 PST 2020
grimar added inline comments.
================
Comment at: llvm/tools/obj2yaml/elf2yaml.cpp:238
ArrayRef<ELFYAML::ProgramHeader> Phdrs,
std::vector<std::unique_ptr<ELFYAML::Chunk>> &V,
ArrayRef<typename ELFT::Shdr> S) {
----------------
jhenderson wrote:
> I take it `V` doesn't normally contain a chunk for the null (index 0) section header?
`V` contains all sections that are dumped from an object. The `SHT_NULL` section is
normally present, it dumped as a regular section, and so `V` usually contains it. This is assumed below:
```
for (const std::unique_ptr<ELFYAML::Chunk> &C :
makeArrayRef(V).drop_front()) {
```
In the case revealed by this patch we have no section header and no sections are dumped,
that's why `V` is empty.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92098/new/
https://reviews.llvm.org/D92098
More information about the llvm-commits
mailing list