]> granicus.if.org Git - clang/commitdiff
Don't create a null reference to NestedNameSpecifier.
authorAlexey Samsonov <vonosmas@gmail.com>
Thu, 28 Aug 2014 22:18:42 +0000 (22:18 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Thu, 28 Aug 2014 22:18:42 +0000 (22:18 +0000)
This bug was reported by UBSan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216691 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ASTMatchers/ASTMatchFinder.cpp

index 050630fd4bd94d30862904b14cada6989f143d45..6c5bc3c3727de8d510cb008fe19465d2a7ff82f1 100644 (file)
@@ -731,7 +731,8 @@ bool MatchASTVisitor::TraverseNestedNameSpecifierLoc(
   match(NNS);
   // We only match the nested name specifier here (as opposed to traversing it)
   // because the traversal is already done in the parallel "Loc"-hierarchy.
-  match(*NNS.getNestedNameSpecifier());
+  if (NNS.hasQualifier())
+    match(*NNS.getNestedNameSpecifier());
   return
       RecursiveASTVisitor<MatchASTVisitor>::TraverseNestedNameSpecifierLoc(NNS);
 }