Skip to content

Commit ea00434

Browse files
authored
Add missing (uint) cast in regex generated code (#69198)
Avoids a possible bounds check
1 parent 10883a7 commit ea00434

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ void EmitFixedSet_LeftToRight()
837837
writer.WriteLine($"// The primary set being searched for was found. {numRemainingSets} more set{(numRemainingSets > 1 ? "s" : "")} will be checked so as");
838838
writer.WriteLine($"// to minimize the number of places TryMatchAtCurrentPosition is run unnecessarily.");
839839
writer.WriteLine($"// Make sure {(numRemainingSets > 1 ? "they fit" : "it fits")} in the remainder of the input.");
840-
using (EmitBlock(writer, $"if ((uint)(i + {maxDistance}) >= span.Length)"))
840+
using (EmitBlock(writer, $"if ((uint)(i + {maxDistance}) >= (uint)span.Length)"))
841841
{
842842
noMatchFoundLabelNeeded = true;
843843
Goto(NoMatchFound);

0 commit comments

Comments
 (0)