[llvm] [llvm-objdump][ELF]Fix crash when reading strings from .dynstr(#86612) (PR #125679)

Ruoyu Qiu via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 02:52:34 PST 2025


================
@@ -221,6 +224,20 @@ template <class ELFT> void ELFDumper<ELFT>::printDynamicSection() {
   std::string TagFmt = "  %-" + std::to_string(MaxLen) + "s ";
 
   outs() << "\nDynamic Section:\n";
+  auto StringTableSize = (typename ELFT::Xword)0;
----------------
cabbaken wrote:

`0` needs to be explicitly convert to `typename ELFT::Xword` to be assigned to `StringTableSize`, and the expression will be `typename ELFT::Xword StringTableSize = (typename ELFT::Xword)0` which is unnecessarily redundant.

https://github.com/llvm/llvm-project/pull/125679


More information about the llvm-commits mailing list