[PATCH] D74510: [ELF] Fix a null pointer dereference when --emit-relocs and --strip-debug are used together

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 16:22:21 PST 2020


MaskRay marked 2 inline comments as done.
MaskRay added inline comments.


================
Comment at: lld/ELF/Driver.cpp:1947
+    if (auto *isec = dyn_cast<InputSection>(s))
+      if (InputSectionBase *rel = isec->getRelocatedSection())
+        if (isDebugSection(rel))
----------------
nickdesaulniers wrote:
> will this fit on one line?
> ```
> if (isDebugSection(isec->getRelocationSection())`
> ```
`rel` may be nullptr, if sh_info=0. Maybe I should make isDebugSection take a reference to emphasize that the argument cannot be nullptr.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74510





More information about the llvm-commits mailing list