[PATCH] D107398: [llvm-readobj][XCOFF] Warn about invalid offset
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 4 00:40:26 PDT 2021
jhenderson added a comment.
I'd request changes if this hadn't landed...
reportUniqueWarning automatically prepends `warning` to the start of the message. If you actually look at your output with this current patch, you'd get `warning: error: ...` which is clearly not whwat you want.
================
Comment at: llvm/tools/llvm-readobj/ObjDumper.cpp:58
+ if (StringContent.size() < StringDataOffset) {
+ reportUniqueWarning("error: offset is out of string contents");
return;
----------------
Please change to "offset X is past the end of the contents (size Y)" with X and Y replaced with the respective values. Errors and warnings should provide useful additional context.
Also, I don't think the case of no string table should be picked up by this warning: in such a case, the behaviour should be to not dump anything (apart from the `StringTable {}`). From my understanding no string table is a perfectly valid XCOFF construct, and should not result in any warnings or errors.
What this warning SHOULD pick up is the case where the section is too small for the offset.
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