diff options
author | Ben Adams <thundercat@illyriad.co.uk> | 2019-01-25 20:03:33 +0100 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-01-25 11:03:33 -0800 |
commit | f487d60b8d48ecbb4e61cfb158038addcd486b0b (patch) | |
tree | 0988b8335a891221c39c172b0992c725594a4aa8 /src/System.Private.CoreLib/shared/System/String.Comparison.cs | |
parent | 8568186a3b918c0239bf6485d56594843b9f544d (diff) | |
download | coreclr-f487d60b8d48ecbb4e61cfb158038addcd486b0b.tar.gz coreclr-f487d60b8d48ecbb4e61cfb158038addcd486b0b.tar.bz2 coreclr-f487d60b8d48ecbb4e61cfb158038addcd486b0b.zip |
Skip rangecheck in string.EndsWith(char) (#22206)
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/String.Comparison.cs')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/String.Comparison.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/shared/System/String.Comparison.cs b/src/System.Private.CoreLib/shared/System/String.Comparison.cs index 5bae67be0e..c8f0d20b48 100644 --- a/src/System.Private.CoreLib/shared/System/String.Comparison.cs +++ b/src/System.Private.CoreLib/shared/System/String.Comparison.cs @@ -594,8 +594,8 @@ namespace System public bool EndsWith(char value) { - int thisLen = Length; - return thisLen != 0 && this[thisLen - 1] == value; + int lastPos = Length - 1; + return ((uint)lastPos < (uint)Length) && this[lastPos] == value; } // Determines whether two strings match. |