[PATCH] D83774: [llvm-readobj] - Verify the location of program headers better.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 23:58:31 PDT 2020


jhenderson accepted this revision.
jhenderson added inline comments.


================
Comment at: llvm/include/llvm/Object/ELF.h:210
+    uint64_t HeadersSize = (uint64_t)getHeader()->e_phnum * getHeader()->e_phentsize;
+    uint64_t Off = getHeader()->e_phoff;
+    if (Off + HeadersSize < Off || Off + HeadersSize > getBufSize())
----------------
Maybe `Offset` rather than `Off` (I'd also take `PhOff`).


================
Comment at: llvm/test/tools/llvm-readobj/ELF/gnu-phdrs.test:389
+
+## Check that we do not report a warning when program headers ends right before the end of the file.
+## 0x160 + size of headers (56) == file size.
----------------
Either "when the program header table ends" or "when the program headers end"


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83774/new/

https://reviews.llvm.org/D83774





More information about the llvm-commits mailing list