]> granicus.if.org Git - clang/commit
Make sure CallExpr::getLocStart doesn't segfault
authorKeno Fischer <kfischer@college.harvard.edu>
Fri, 15 Aug 2014 01:39:12 +0000 (01:39 +0000)
committerKeno Fischer <kfischer@college.harvard.edu>
Fri, 15 Aug 2014 01:39:12 +0000 (01:39 +0000)
commit8444ae7cfeaefae031f8fedf0d1435ca3b14d90b
treec768e4730c1e979256cb03e839e2649d7ea11f5b
parent99af5d60f1c51b67547fb82056221f2dd7f88aaa
Make sure CallExpr::getLocStart doesn't segfault

Summary:
When the CallExpr passed to Sema::ConvertArgumentsForCall has all default parameters, and the number of actual arguments passed is zero, this function will segfault in the call to Call->getLocStart() if the Callee has an invalid getLocStart(), the reason being that since ConvertArgumentsForCall has set the correct number of arguments, but has not filled them in yet, getLocStart() will try to access the first (not yet existent) argument and thus segfaults.

This fixes that by making getLocStart return an invalid source location if the queried argument is NULL rather than segfaulting.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4917

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215686 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/Expr.h
lib/AST/Expr.cpp