summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseCXXInlineMethods.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-12-28 23:24:02 +0000
committerNico Weber <nicolasweber@gmx.de>2014-12-28 23:24:02 +0000
commitc29c4835dfc2a3be6c156ce6f54995221ac480a8 (patch)
tree387ea4b00079cb13f9bf791d04b06d5efab222f5 /clang/lib/Parse/ParseCXXInlineMethods.cpp
parent380443a2ac10906010e3d622b92395bdf8dbc82b (diff)
downloadbcm5719-llvm-c29c4835dfc2a3be6c156ce6f54995221ac480a8.tar.gz
bcm5719-llvm-c29c4835dfc2a3be6c156ce6f54995221ac480a8.zip
Don't crash on surprising tokens in default parameter template lists.
Fixes this snippet from SLi's afl fuzzer output: class { i (x = <, enum This parsed i as a function, x as a paramter, and the stuff after < as a template list. This then called TryConsumeDeclarationSpecifier() which called TryAnnotateCXXScopeToken() without checking the preconditions of this function. Check them before calling, like all other callers of TryAnnotateCXXScopeToken() do. A more readable reproducer that causes the same crash is class { void i(int x = MyTemplateClass<int, union int>::foo()); }; The reduced version used an eof token as surprising token, but kw_int works just as well to repro and is easier to insert into a test file. llvm-svn: 224906
Diffstat (limited to 'clang/lib/Parse/ParseCXXInlineMethods.cpp')
-rw-r--r--clang/lib/Parse/ParseCXXInlineMethods.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp
index e39f2f1627b..7c9cceb12bc 100644
--- a/clang/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp
@@ -1019,7 +1019,7 @@ bool Parser::ConsumeAndStoreInitializer(CachedTokens &Toks,
case CIK_DefaultArgument:
bool InvalidAsDeclaration = false;
Result = TryParseParameterDeclarationClause(
- &InvalidAsDeclaration, /*VersusTemplateArgument*/true);
+ &InvalidAsDeclaration, /*VersusTemplateArgument=*/true);
// If this is an expression or a declaration with a missing
// 'typename', assume it's not a declaration.
if (Result == TPResult::Ambiguous && InvalidAsDeclaration)
OpenPOWER on IntegriCloud