[PATCH] D107398: [llvm-readobj][XCOFF] Warn about invalid offset
    Esme Yi via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Aug  4 00:47:52 PDT 2021
    
    
  
Esme added inline comments.
================
Comment at: llvm/tools/llvm-readobj/ObjDumper.cpp:58
+  if (StringContent.size() < StringDataOffset) {
+    reportUniqueWarning("error: offset is out of string contents");
     return;
----------------
vitalybuka wrote:
> jhenderson wrote:
> > 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.
> @Esme Would you like to follow up on this?
Yes, of course. at vitalybuka
Thanks @jhenderson, I think the warning report should be added in this function and I will change the warning message according to your comments.
> From my understanding no string table is a perfectly valid XCOFF construct, and should not result in any warnings or errors.
Yes, as for XCOFF, I've added an early out in rG737e27f6236f.
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