[PATCH] D93362: [llvm-elfabi] Support ELF file that lacks .gnu.hash section
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 26 01:09:36 PST 2021
jhenderson added a comment.
In D93362#2521739 <https://reviews.llvm.org/D93362#2521739>, @haowei wrote:
> I plan to land this patch since the issue raised is a preexisting one and I prefer to address it in a separate change.
>
> What would be the best way to use the unit test to cover the out of bound issue (between Diff 9 and 10)? It looks like even with the small bug in Diff 9, the current unit test didn't raise any memory errors even though the pointer `It` was accessing the `Buf.bytes_end()`.
I'm not 100% sure, but I think if you were to have an input where the hash table was the very last thing in the ELF (i.e. after all sections, and, if present, the section header table too), you might (sometimes) see a crash. Being a memory access issue, it's possible you won't see it every run, but I'd somewhat expect a sanitizer to complain at some point. You could also have a test case where it isn't the last thing in the input and the very next byte is something readable, but of a value where it does something funky. You probably also need to have your input corrupted so that the chain doesn't end before the end of the section.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93362/new/
https://reviews.llvm.org/D93362
More information about the llvm-commits
mailing list