[PATCH] D77216: [llvm-readobj] - Fix crashes and misbehaviors when reading strings from broken string tables.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 02:37:08 PDT 2020


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/dynamic-malformed.test:384
+
+## Note: strings are dumped because the file ends with the zero byte. Code reads the data
+## in [DT_STRTAB, DT_STRTAB + DT_STRSZ] range as a as a normal null-terminated string table.
----------------
jhenderson wrote:
> > strings are dumped because the file ends with the zero byte
> 
> What guarantees this? Should we add something to either a) validate it (to make it easier to identify the problem if it doesn't end with a zero byte) or b) force it to always be zero?
But should we care/do something more? The intention of this test is to document the behavior when "the value of DT_STRSZ tag is set so that the string table ends right before the EOF". In this case dumping of strings is a side effect, so I've put a "Note". If the file had no zero byte at the end, we would dump "<?>", but what we really want to check is that we do not crash here and in the "Case B" below.


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

https://reviews.llvm.org/D77216





More information about the llvm-commits mailing list