[PATCH] D61715: fix a null pointer deref issue

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 19:42:56 PDT 2019


skan created this revision.
skan added reviewers: craig.topper, LuoYuanke, xiangzhangllvm.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

[static check]
Pointer from call to function ```DebugLoc::operator DILocation *() const ``` may be NULL and will be dereference in function ```printExtendedName```.


Repository:
  rL LLVM

https://reviews.llvm.org/D61715

Files:
  lib/CodeGen/LiveDebugVariables.cpp


Index: lib/CodeGen/LiveDebugVariables.cpp
===================================================================
--- lib/CodeGen/LiveDebugVariables.cpp
+++ lib/CodeGen/LiveDebugVariables.cpp
@@ -504,7 +504,8 @@
 
   if (!Res.empty())
     OS << Res << "," << Line;
-  if (auto *InlinedAt = DL->getInlinedAt()) {
+  auto *InlinedAt = DL ? DL->getInlinedAt() : nullptr;
+  if (InlinedAt) {
     if (DebugLoc InlinedAtDL = InlinedAt) {
       OS << " @[";
       printDebugLoc(InlinedAtDL, OS, Ctx);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61715.198755.patch
Type: text/x-patch
Size: 494 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190509/efccc049/attachment.bin>


More information about the llvm-commits mailing list