[PATCH] D85519: [llvm-readobj/elf] - Refine the code for broken PT_DYNAMIC segment diagnostic.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 05:32:35 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a project: LLVM.
grimar requested review of this revision.

The code that reports "PT_DYNAMIC segment offset + size exceeds the size of the file"
has issues:

1. Values for size/offset are not printed.
2. It is possible to bypass the validation by overflowing the size + offset result.

The related test case also can be improved/simplified:

1. Use `NoHeaders: true` instead of `llvm-objcopy --strip-sections`.
2. Use YAML properties to simulate the truncation of the object instad of using a python.
3. Test llvm-readelf too (not just llvm-readobj).
4. Test a 32-bits object as well.
5. Simplify the YAML a bit (e.g. remove PT_LOAD).


https://reviews.llvm.org/D85519

Files:
  llvm/test/Object/invalid.test
  llvm/test/tools/llvm-readobj/ELF/malformed-pt-dynamic.test
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85519.283880.patch
Type: text/x-patch
Size: 7168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200807/c9a5ee79/attachment-0001.bin>


More information about the llvm-commits mailing list