Skip to content

Commit

Permalink
continue parsing after nested call
Browse files Browse the repository at this point in the history
Commit migrated from dotnet/corefx@b2865f5
MarcoRossignoli committed Mar 1, 2019
1 parent 6895250 commit 357812c
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -431,9 +431,12 @@ private static HttpParseResult GetExpressionLength(string input, int startIndex,
{
nestedCount--;
}

// after nested call we continue with parsing
continue;
}

if (current < input.Length && input[current] == closeChar)
if (input[current] == closeChar)
{
length = current - startIndex + 1;
return HttpParseResult.Parsed;
Original file line number Diff line number Diff line change
@@ -241,6 +241,8 @@ public void GetCommentLength_SetOfValidComments_AllConsideredValid()
AssertGetCommentLength("((\\)))", 0, 6, HttpParseResult.Parsed); // ((\))) -> quoted-pair )
AssertGetCommentLength("((\\())", 0, 6, HttpParseResult.Parsed); // ((\()) -> quoted-pair (
AssertGetCommentLength("((x)))", 0, 5, HttpParseResult.Parsed); // final ) ignored
AssertGetCommentLength("(x (y)(z))", 0, 10, HttpParseResult.Parsed);
AssertGetCommentLength("(x(y)\\()", 0, 8, HttpParseResult.Parsed);
}

[Fact]
@@ -257,6 +259,12 @@ public void GetCommentLength_SetOfInvalidQuotedStrings_AllConsideredInvalid()
// of nested comments. I.e. the following comment is considered invalid since it is considered a
// "malicious" comment.
AssertGetCommentLength("((((((((((x))))))))))", 0, 0, HttpParseResult.InvalidFormat);
AssertGetCommentLength("(x(x)", 0, 0, HttpParseResult.InvalidFormat);
AssertGetCommentLength("(x(x(", 0, 0, HttpParseResult.InvalidFormat);
AssertGetCommentLength("(x(()", 0, 0, HttpParseResult.InvalidFormat);
AssertGetCommentLength("(()", 0, 0, HttpParseResult.InvalidFormat);
AssertGetCommentLength("(", 0, 0, HttpParseResult.InvalidFormat);
AssertGetCommentLength("((x)", 0, 0, HttpParseResult.InvalidFormat);
}

[Fact]

0 comments on commit 357812c

Please sign in to comment.