Skip to content

Fix IndexOutOfRangeException in RegexInterpreter.Backtrack method #115733

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

Closed
wants to merge 4 commits into from
Closed
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 @@ -129,7 +129,16 @@
{
CheckTimeout(); // to ensure that any backtracking operation has a timeout check

int newpos = runtrack![runtrackpos];
// Check if we've exhausted the backtrack stack
if (runtrackpos >= runtrack!.Length)
{
// Match failed, so we should just return with no match
runmatch!.FoundMatch = false;

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm Debug AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug AllSubsets_Mono_LLVMAOT)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build tvossimulator-x64 Debug AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Mono_Interpreter_LibrariesTests)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build maccatalyst-arm64 Release AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Release AllSubsets_Mono_LLVMAOT)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Mono_MiniJIT_LibrariesTests)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm64 Release AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Release AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm Release AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Release AllSubsets_Mono_LLVMAOT)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Release AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug Mono_MiniJIT_LibrariesTests)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug Mono_MiniJIT_LibrariesTests)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Release NativeAOT_Libraries)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build tvos-arm64 Release AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build maccatalyst-x64 Release AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Release NativeAOT_Libraries)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm64 Release AllSubsets_CoreCLR)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build ios-arm64 Release AllSubsets_Mono)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-x64 Release AllSubsets_CoreCLR)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug AllSubsets_CoreCLR)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm64 Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug CoreCLR_Libraries)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build tvos-arm64 Release AllSubsets_NativeAOT)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build linux-x64 release Runtime_Release)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug AllSubsets_CoreCLR)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build browser-wasm linux Release LibraryTests)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build browser-wasm linux release Runtime_Release)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug CoreCLR_Libraries)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build browser-wasm linux Release LibraryTests_EAT)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug Libraries_CheckedCoreCLR)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build ios-arm64 Release AllSubsets_NativeAOT)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug AllSubsets_CoreCLR)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build browser-wasm linux Release LibraryTests_Smoke_AOT)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build browser-wasm linux Debug AllSubsets_CoreCLR)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug Libraries_CheckedCoreCLR)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build osx-x64 release Runtime_Release)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug CoreCLR_Libraries)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build linux-x64 debug Libraries_WithPackages)

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build Source-Build (Linux_x64))

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only

Check failure on line 136 in src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs#L136

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexInterpreter.cs(136,17): error CS0200: (NETCORE_ENGINEERING_TELEMETRY=Build) Property or indexer 'Match.FoundMatch' cannot be assigned to -- it is read only
SetOperator(RegexOpcode.Stop);
return;
}

int newpos = runtrack[runtrackpos];
runtrackpos++;

int back = (int)RegexOpcode.Backtracking;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using Xunit;

namespace System.Text.RegularExpressions.Tests
{
public class RegexBacktrackingTests
{
[Fact]
public void PossessiveQuantifierWithLazyQuantifierShouldNotThrow()
{
// This specific pattern caused IndexOutOfRangeException before the fix
var regex = new Regex(@"(?>(-*)+?-*)$");

// Test with input that would previously throw
Match match = regex.Match("test");

// Verify it doesn't throw and correctly reports no match
Assert.False(match.Success, "When backtracking stack is exhausted, match should be unsuccessful");
}

[Theory]
[InlineData(@"(?>(-*)+?-*)$", "test", false)]
[InlineData(@"(?>(-*)+?-*)$", "abcdef", false)]
[InlineData(@"(?>(-+)+?-*)$", "test", false)]
[InlineData(@"(?>a*)+?", "aaaaaaaa", true)]
[InlineData(@"(?>(-{50000})+?-*)$", "test", false)] // Large repeat count
[InlineData(@"((?>a+)+b)+c", "aababc", true)] // Complex nesting
public void ComplexBacktrackingShouldNotThrow(string pattern, string input, bool expectedMatch)
{
// Tests various patterns that might stress the backtracking system
var regex = new Regex(pattern);

// Act - should not throw
Match match = regex.Match(input);

// Verify expected match result
Assert.Equal(expectedMatch, match.Success);
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot you are missing a newline here in the end of the file

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<Compile Include="Regex.Split.Tests.cs" />
<Compile Include="Regex.Tests.Common.cs" />
<Compile Include="Regex.UnicodeChar.Tests.cs" />
<Compile Include="RegexBacktrackingTests.cs" />
<Compile Include="RegexCharacterSetTests.cs" />
<Compile Include="RegexCultureTests.cs" />
<Compile Include="RegexMatchTimeoutExceptionTests.cs" />
Expand Down
Loading