[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
Fri Apr 17 04:50:07 PDT 2020


grimar added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/dynamic-malformed.test:384-385
+
+## 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 normal null-terminated string table.
+# BEFORE-THE-EOF:      {{[(]?}}NEEDED{{[)]?}}    Shared library: [test.soabc]
----------------
jhenderson wrote:
> I think if we rewrite this note slightly, we could clarify more that it's not important what the final byte is:
> 
> "Note: The code reads the data in [DT_STRTAB, DT_STRTAB + DT_STRSZ] as the string table as normal. Since the file ends with a zero byte, strings are dumped, but if it didn't, we'd get <?> printed instead. The important bit is that we don't get the past the end warning."
Reads better, thanks.


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

https://reviews.llvm.org/D77216





More information about the llvm-commits mailing list