Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed to call EnsureStorage() unconditionally.
If EnsureStorage() is called unconditionally, the array will be expanded, so the position will never become negative. When the conditions inside EnsureStorage() are true, it might be necessary to expand the array, regardless of the comparison between newpos and codepos. https://github.com/dotnet/runtime/blob/6ebc8bd86dbc780b2a2a7daf3ab6020f9104f09e/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.MultipleMatches.Tests.cs#L461-L469 Before the change, in this test case, EnsureStorage() is not called because newpos == codepos == 6 from the first time until an exception occurs. Fix dotnet#62049
- Loading branch information