[PATCH] D43958: [llvm-readobj][ELF] Move ELF note parsing into lib/Object

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 12:55:00 PDT 2018


scott.linder added inline comments.


================
Comment at: include/llvm/Object/ELF.h:173
+    }
+    if (Phdr.p_offset + Phdr.p_filesz > getBufSize()) {
+      Err = createError("invalid program header offset/size");
----------------
t-tye wrote:
> Should this return the end iterator if the note section size is 0?
> 
> If not the end_iterator should this check that the total size of the note record (including the data of the name and desc) fits in the section? The operator++ does that check.
If the size (`p_filesz`) is 0 here, the `advanceNhdr` call in the Iterator constructor will immediately see that `RemainingSize == 0` and end iteration cleanly. The check is done in the Iterator because it would otherwise be duplicated here: once for program headers, and once for sections.


Repository:
  rL LLVM

https://reviews.llvm.org/D43958





More information about the llvm-commits mailing list