Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inadvertently case sensitive Boyer-Moore #39420

Merged
merged 4 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1335,9 +1335,8 @@ protected void GenerateFindFirstChar()
}

// ch = runtext[runtextpos];
// if (ch == lastChar) goto partialMatch;
Rightchar();
if (_boyerMoorePrefix.CaseInsensitive && ParticipatesInCaseConversion(chLast))
if (_boyerMoorePrefix.CaseInsensitive)
{
CallToLower();
}
Expand All @@ -1349,6 +1348,7 @@ protected void GenerateFindFirstChar()
Ldloc(chLocal);
Ldc(chLast);

// if (ch == lastChar) goto partialMatch;
BeqFar(lPartialMatch);

// ch -= lowAscii;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class RegexMatchTests
public static IEnumerable<object[]> Match_Basic_TestData()
{
// pattern, input, options, beginning, length, expectedSuccess, expectedValue
yield return new object[] { @"H#", "#H#", RegexOptions.IgnoreCase, 0, 3, true, "H#" }; // https://github.com/dotnet/runtime/issues/39390
yield return new object[] { @"H#", "#H#", RegexOptions.None, 0, 3, true, "H#" };

// Testing octal sequence matches: "\\060(\\061)?\\061"
// Octal \061 is ASCII 49 ('1')
Expand Down