There are cases when we either might print garbage or crash when
reading strings for dumping dynamic tags.
For example when a string table is not null-terminated or goes past the EOF.
This patch fixes issues mentioned.
Paths
| Differential D77216
[llvm-readobj] - Fix crashes and misbehaviors when reading strings from broken string tables. ClosedPublic Authored by grimar on Apr 1 2020, 7:27 AM.
Details Summary There are cases when we either might print garbage or crash when For example when a string table is not null-terminated or goes past the EOF.
Diff Detail
Event TimelineComment Actions Hmmm... my first instinct here is that we should print a single warning out-of-line, and then use the "<?>" pattern in place of the invalid strings. That probably goes for the existing messages too. What do you think about that idea? Comment Actions
Yeah, I've though about that we might want to change the code to this behavior as it would be more consistent with all kinds of other errors we have. Comment Actions Thanks! Please wait a bit for @jhenderson's opinions (I think today is a public holiday (Easter Monday)) This revision is now accepted and ready to land.Apr 13 2020, 9:05 AM
grimar added inline comments.
grimar marked 8 inline comments as done. Comment Actions
grimar marked 4 inline comments as done. Comment Actions
Closed by commit rGe19628fde58e: [llvm-readobj] - Fix crashes and misbehaviors when reading strings from broken… (authored by grimar). · Explain WhyApr 20 2020, 4:48 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 258703 llvm/test/tools/llvm-readobj/ELF/dynamic-malformed.test
llvm/test/tools/llvm-readobj/ELF/loadname.test
llvm/test/tools/llvm-readobj/ELF/needed-libs.test
llvm/tools/llvm-readobj/ELFDumper.cpp
|
--implicit-check-not=warning: is probably better to avoid weird failures with path names involving "warning" (there's bound to be somebody out there...).
Same below.