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

Tony Tye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 13:07:31 PDT 2018


t-tye added a comment.

LGTM



================
Comment at: include/llvm/Object/ELF.h:173
+    }
+    if (Phdr.p_offset + Phdr.p_filesz > getBufSize()) {
+      Err = createError("invalid program header offset/size");
----------------
scott.linder wrote:
> 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.
Sorry, I noticed that and was going to retract my comment but you beat me to it:-)


Repository:
  rL LLVM

https://reviews.llvm.org/D43958





More information about the llvm-commits mailing list