Currently, ELFFile<ELFT>::getEntry does not check an index of
an entry. Because of that the code might read past the end of the symbol
table silently. I've added a test to llvm-readobj\ELF\relocations.test
to demonstrate the possible issue. Also, I've added a unit test for
this method.
After this change, getEntry stops reporting the section index and
reuses the getSectionContentsAsArray method, which already has
all the validation needed. Our related warnings now provide
more and better context sometimes.
This multiplication does not produce consistent results across hosts, as size_t may or may not be 64 bits so the result may or may not be truncated to 32 bits. It's fairly harmless since it's just the error message that's affected, but it causes test failures on some hosts. The original code cast Entry to uint64_t before multiplying, I think the new code needs to do the same.