[PATCH] D107398: [llvm-readobj][XCOFF] Warn about invalid offset

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 5 00:32:10 PDT 2021


jhenderson added a comment.

With this version of the patch, we don't need the check added in rG737e27f6236f <https://reviews.llvm.org/rG737e27f6236f18dcac53130242756ba0cc1dfe7d>. By reverting that, we can then test this warning properly, with a string table that is not the right size (e.g. 3 bytes for XCOFF).



================
Comment at: llvm/tools/llvm-readobj/ObjDumper.cpp:58
+  size_t StrSize = StringContent.size();
+  if (!StrSize)
+    return;
----------------
Personally, I find it clearer if we're explicit about this comparison.


================
Comment at: llvm/tools/llvm-readobj/ObjDumper.cpp:62
+    reportUniqueWarning("offset (0x" + Twine::utohexstr(StringDataOffset) +
+                        ") is past the end of the contents size (0x" +
+                        Twine::utohexstr(StrSize) + ")");
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107398



More information about the llvm-commits mailing list