[PATCH] D69192: llvm-objdump can error out with an unexpected EOF error if .bss is larger than the file being dumped.
Sid Manning via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 24 06:50:40 PDT 2019
sidneym marked an inline comment as done.
sidneym added inline comments.
================
Comment at: llvm/include/llvm/Object/ELFObjectFile.h:727
+ if (EShdr->sh_type == ELF::SHT_NOBITS)
+ return makeArrayRef((const uint8_t *)base() + EShdr->sh_offset, 0);
if (std::error_code EC =
----------------
grimar wrote:
> MaskRay wrote:
> > Delete `+ sh_offset` to solve the problem I described in a previous comment.
> It is strange to know that sh_offset can be greater than the file size.
>
> If we want to have this change and not error out, I'd add a comment and a one more test case for
> this (yaml2obj allows overriding the sh_offset with use of "ShOffset" field).
I don't think sh_offset will be larger than the file size but sh_offset+sh_size can be and that would cause checkOffset to fail. I guess one could argue that if sh_offset is outside the scope of the file something is really bogus about the file but if the section NOBITS maybe it doesn't matter.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69192/new/
https://reviews.llvm.org/D69192
More information about the llvm-commits
mailing list