llvm-project/clang/lib/Parse
Nico Weber c29c4835df 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
2014-12-28 23:24:02 +00:00
..
CMakeLists.txt [CMake] Reorder libdeps by alphabetical order. 2014-07-14 04:59:27 +00:00
Makefile
ParseAST.cpp Remove unneeded include of DeclCXX.h from libParse. 2014-12-28 01:52:28 +00:00
ParseCXXInlineMethods.cpp Don't crash on surprising tokens in default parameter template lists. 2014-12-28 23:24:02 +00:00
ParseDecl.cpp Parse: Don't crash when 'typename' shows up in an attribute 2014-12-28 22:28:32 +00:00
ParseDeclCXX.cpp Added a fixit to remove empty parens from a C++11 attribute argument list when we diagnose this as an error. 2014-12-19 18:37:22 +00:00
ParseExpr.cpp Fix two small bugs in typo correction. One assertion failure building member expressions because the lookup finds a different name than the original, fixed by updating the LookupResult's name with the name of the found decl. Second is that we also diagnose delayed typo exprs in the index of an array subscript expression. 2014-12-13 02:54:28 +00:00
ParseExprCXX.cpp Parse: Consume tokens more carefully in CheckForLParenAfterColonColon 2014-12-17 01:39:22 +00:00
ParseInit.cpp Enable ActOnIdExpression to use delayed typo correction for non-C++ code 2014-11-21 18:48:04 +00:00
ParseObjc.cpp Modified the Objective-C lexer and parser (only 2014-12-09 23:47:56 +00:00
ParseOpenMP.cpp Enable ActOnIdExpression to use delayed typo correction for non-C++ code 2014-11-21 18:48:04 +00:00
ParsePragma.cpp Parse: Ignore "long" and "short" in #pragma section 2014-10-22 21:08:43 +00:00
ParseStmt.cpp Removing an outdated FIXME; try block attributes are parsed with the rest of the statement attributes (as per the standard), and function-try-blocks may not have attributes. NFC. 2014-12-20 01:54:07 +00:00
ParseStmtAsm.cpp Enable ActOnIdExpression to use delayed typo correction for non-C++ code 2014-11-21 18:48:04 +00:00
ParseTemplate.cpp Diagnose function template definitions inside functions 2014-12-15 23:16:32 +00:00
ParseTentative.cpp Don't crash on surprising tokens in default parameter template lists. 2014-12-28 23:24:02 +00:00
Parser.cpp Diagnose function template definitions inside functions 2014-12-15 23:16:32 +00:00
RAIIObjectsForParser.h Header guard canonicalization, clang part. 2014-08-13 16:25:19 +00:00