Fix for rdar://problem/19563867, Fuzzing Swift: Parser::parseTopLevel() crashes in Verifier::walkToPatternPost(swift::Pattern*):

a vararg subpattern of a TuplePattern should be a TypedPattern

Check for a vararg subpattern to be a typed pattern seemed to be missing in closure arguments parsing.



Swift SVN r24733
This commit is contained in:
Denis Vnukov
2015-01-26 21:11:32 +00:00
parent e318a8c2e8
commit 196d500439
2 changed files with 5 additions and 0 deletions

View File

@@ -540,6 +540,9 @@ mapParsedParameters(Parser &parser,
parser.diagnose(param.EllipsisLoc, diag::parameter_ellipsis_not_at_end)
.fixItRemove(param.EllipsisLoc);
param.EllipsisLoc = SourceLoc();
} else if (!isa<TypedPattern>(pattern)) {
parser.diagnose(param.EllipsisLoc, diag::untyped_pattern_ellipsis)
.highlight(pattern->getSourceRange());
} else {
ellipsisLoc = param.EllipsisLoc;
}