[ASan] Do not print thread IDs and stacks for unknown threads.
authorAlexander Potapenko <glider@google.com>
Mon, 6 Apr 2015 10:32:45 +0000 (10:32 +0000)
committerAlexander Potapenko <glider@google.com>
Mon, 6 Apr 2015 10:32:45 +0000 (10:32 +0000)
llvm-svn: 234147

compiler-rt/lib/asan/asan_report.cc

index c1c340c..62c814e 100644 (file)
@@ -578,6 +578,11 @@ void DescribeThread(AsanThreadContext *context) {
   InternalScopedString str(1024);
   str.append("Thread T%d%s", context->tid,
              ThreadNameWithParenthesis(context->tid, tname, sizeof(tname)));
+  if (context->parent_tid == kInvalidTid) {
+    str.append(" created by unknown thread\n");
+    Printf("%s", str.data());
+    return;
+  }
   str.append(
       " created by T%d%s here:\n", context->parent_tid,
       ThreadNameWithParenthesis(context->parent_tid, tname, sizeof(tname)));