2636 references to Length
http2cat (39)
src\Shared\Http2cat\Http2Utilities.cs (2)
285var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength); 371var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength);
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\Shared\runtime\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
IIS.FunctionalTests (39)
src\Shared\Http2cat\Http2Utilities.cs (2)
285var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength); 371var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength);
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\Shared\runtime\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
IIS.LongTests (39)
src\Shared\Http2cat\Http2Utilities.cs (2)
285var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength); 371var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength);
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\Shared\runtime\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
IIS.NewHandler.FunctionalTests (39)
src\Shared\Http2cat\Http2Utilities.cs (2)
285var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength); 371var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength);
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\Shared\runtime\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
IIS.NewShim.FunctionalTests (39)
src\Shared\Http2cat\Http2Utilities.cs (2)
285var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength); 371var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength);
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\Shared\runtime\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
IIS.ShadowCopy.Tests (10)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
IISExpress.FunctionalTests (39)
src\Shared\Http2cat\Http2Utilities.cs (2)
285var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength); 371var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength);
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\Shared\runtime\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
InMemory.FunctionalTests (5)
Http2\Http2TestBase.cs (2)
635var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength); 725var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength);
Http3\Http3StreamTests.cs (2)
2867for (var i = 0; i < chars.Length; i++) 2907for (var i = 0; i < chars.Length; i++)
src\Servers\Kestrel\shared\test\PipeWriterHttp2FrameExtensions.cs (1)
73frame.PayloadLength = headerData.Length;
Microsoft.AspNetCore.Components (10)
ParameterView.cs (3)
217if (oldDirectParameterFrames.Length == 0) 224if (newDirectParameterFrames.Length < oldDirectParameterFrames.Length)
src\Shared\UrlDecoder\UrlDecoder.cs (7)
20if (destination.Length < source.Length) 52if (sourceIndex == buffer.Length) 155if (sourceIndex == buffer.Length) 303if (scan == buffer.Length) 385return buffer.Length; 396if (sourceIndex == buffer.Length) 491if (sourceIndex == buffer.Length)
Microsoft.AspNetCore.Components.Endpoints (2)
Rendering\EndpointHtmlRenderer.Streaming.cs (1)
145for (var i = 0; i < componentIdsInDepthOrder.Length; i++)
Rendering\TypeNameHash.cs (1)
26written = typeNameBytes.Length;
Microsoft.AspNetCore.Components.Forms (6)
src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (6)
27_nextEndIndex = _currentBuffer.Length; 33_nextEndIndex = _currentBuffer.Length; 36public bool Empty => _nextEndIndex == _currentBuffer.Length; 59var sizeToRent = _currentBuffer.Length + Math.Max(MinimumRentedArraySize, remainingLength * 2); 63_nextEndIndex = newBuffer.Length - _currentBuffer.Length; 85startIndex = _currentBuffer.Length - remainingLength;
Microsoft.AspNetCore.Components.QuickGrid (1)
Columns\GridSort.cs (1)
172var nextPos = chars.Length;
Microsoft.AspNetCore.Components.Server (11)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
249Debug.Assert(span.Length >= _bytesWritten);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\BufferWriter.cs (4)
162if (_span.Length >= source.Length) 180if (_span.Length < count) 234if (_span.Length == 0) 239var writable = Math.Min(bytesLeftToCopy, _span.Length);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReader.cs (6)
457if (firstSpan.Length >= destination.Length) 459firstSpan.Slice(0, destination.Length).CopyTo(destination); 468if (this.Remaining < destination.Length) 474Debug.Assert(firstSpan.Length < destination.Length, "firstSpan.Length < destination.Length"); 484int toCopy = Math.Min(nextSpan.Length, destination.Length - copied); 487if (copied >= destination.Length)
Microsoft.AspNetCore.Components.Server.Tests (6)
Circuits\RenderBatchWriterTest.cs (6)
39Assert.Equal(36, bytes.Length); // No other data 66Assert.Equal(48, bytes.Length); // No other data 93Assert.Equal(60, bytes.Length); // No other data 135Assert.Equal(60, bytes.Length); // No other data 169var diffsStartIndex = ReadInt(bytes, bytes.Length - 20); 233var referenceFramesStartIndex = ReadInt(bytes, bytes.Length - 16);
Microsoft.AspNetCore.Components.Web (6)
src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (6)
27_nextEndIndex = _currentBuffer.Length; 33_nextEndIndex = _currentBuffer.Length; 36public bool Empty => _nextEndIndex == _currentBuffer.Length; 59var sizeToRent = _currentBuffer.Length + Math.Max(MinimumRentedArraySize, remainingLength * 2); 63_nextEndIndex = newBuffer.Length - _currentBuffer.Length; 85startIndex = _currentBuffer.Length - remainingLength;
Microsoft.AspNetCore.DataProtection.Abstractions (1)
src\Shared\WebEncoders\WebEncoders.cs (1)
344Debug.Assert(output.Length >= GetArraySizeRequiredToEncode(input.Length));
Microsoft.AspNetCore.Http (1)
src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (1)
561for (var i = 0; i < ArrayStorageSpan.Length; ++i)
Microsoft.AspNetCore.Http.Abstractions (15)
Extensions\HttpResponseWritingExtensions.cs (1)
78if (encodedLength <= destination.Length)
src\Shared\UrlDecoder\UrlDecoder.cs (7)
20if (destination.Length < source.Length) 52if (sourceIndex == buffer.Length) 155if (sourceIndex == buffer.Length) 303if (scan == buffer.Length) 385return buffer.Length; 396if (sourceIndex == buffer.Length) 491if (sourceIndex == buffer.Length)
src\Shared\ValueStringBuilder\ValueListBuilder.cs (7)
33if ((uint)pos < (uint)span.Length) 47Debug.Assert(_pos == _span.Length); 78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
Microsoft.AspNetCore.Http.Connections (2)
src\Shared\WebEncoders\WebEncoders.cs (1)
344Debug.Assert(output.Length >= GetArraySizeRequiredToEncode(input.Length));
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
249Debug.Assert(span.Length >= _bytesWritten);
Microsoft.AspNetCore.Http.Extensions (23)
src\Shared\ValueStringBuilder\ValueListBuilder.cs (7)
33if ((uint)pos < (uint)span.Length) 47Debug.Assert(_pos == _span.Length); 78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (16)
38Debug.Assert(value <= _chars.Length); 43public int Capacity => _chars.Length; 51if ((uint)capacity > (uint)_chars.Length) 137if (_pos > _chars.Length - count) 157if (_pos > (_chars.Length - count)) 172if ((uint)pos < (uint)_chars.Length) 192if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 206if (pos > _chars.Length - s.Length) 217if (_pos > _chars.Length - count) 223for (int i = 0; i < dst.Length; i++) 233if (pos > _chars.Length - length) 239for (int i = 0; i < dst.Length; i++) 249if (pos > _chars.Length - value.Length) 262if (origPos > _chars.Length - length) 290Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 293char[] poolArray = ArrayPool<char>.Shared.Rent((int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), (uint)_chars.Length * 2));
Microsoft.AspNetCore.HttpLogging (23)
src\Shared\ValueStringBuilder\ValueListBuilder.cs (7)
33if ((uint)pos < (uint)span.Length) 47Debug.Assert(_pos == _span.Length); 78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (16)
38Debug.Assert(value <= _chars.Length); 43public int Capacity => _chars.Length; 51if ((uint)capacity > (uint)_chars.Length) 137if (_pos > _chars.Length - count) 157if (_pos > (_chars.Length - count)) 172if ((uint)pos < (uint)_chars.Length) 192if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 206if (pos > _chars.Length - s.Length) 217if (_pos > _chars.Length - count) 223for (int i = 0; i < dst.Length; i++) 233if (pos > _chars.Length - length) 239for (int i = 0; i < dst.Length; i++) 249if (pos > _chars.Length - value.Length) 262if (origPos > _chars.Length - length) 290Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 293char[] poolArray = ArrayPool<char>.Shared.Rent((int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), (uint)_chars.Length * 2));
Microsoft.AspNetCore.Identity.FunctionalTests (12)
src\Identity\Extensions.Core\src\Base32.cs (7)
32for (int offset = 0; offset < bytes.Length;) 123switch (input.Length - offset) 132b1 = (offset < input.Length) ? input[offset++] : 0U; 133b2 = (offset < input.Length) ? input[offset++] : 0U; 134b3 = (offset < input.Length) ? input[offset++] : 0U; 135b4 = (offset < input.Length) ? input[offset++] : 0U; 136b5 = (offset < input.Length) ? input[offset++] : 0U;
src\Identity\Extensions.Core\src\Rfc6238AuthenticationService.cs (5)
54Debug.Assert(written == hash.Length); 60var offset = hash[hash.Length - 1] & 0xf; 61Debug.Assert(offset + 4 < hash.Length); 72var combined = new byte[checked(input.Length + modifierBytes.Length)]; 74Buffer.BlockCopy(modifierBytes, 0, combined, input.Length, modifierBytes.Length);
Microsoft.AspNetCore.OpenApi (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
249Debug.Assert(span.Length >= _bytesWritten);
Microsoft.AspNetCore.OutputCaching (4)
FormatterBinaryWriter.cs (2)
116length = span.Length; 200var toWrite = Math.Min(value.Length, available.Length);
RecyclableSequenceBuilder.cs (2)
92if (available.Length >= buffer.Length) 100var toWrite = Math.Min(buffer.Length, available.Length);
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (1)
EndToEndBenchmarks.cs (1)
98bytes = Math.Min(bytes, span.Length);
Microsoft.AspNetCore.Razor.Runtime (2)
Runtime\TagHelpers\TagHelperRunner.cs (2)
37for (var i = 0; i < tagHelpers.Length; i++) 42return Awaited(task, executionContext, i + 1, tagHelpers.Length);
Microsoft.AspNetCore.Routing (14)
Matching\DefaultEndpointSelector.cs (3)
26switch (candidateState.Length) 63for (var i = 0; i < candidateState.Length; i++) 112for (var i = 0; i < candidateState.Length; i++)
Matching\FastPathTokenizer.cs (2)
27while ((end = span.IndexOf('/')) >= 0 && count < segments.Length) 36if (length > 0 && count < segments.Length)
Matching\HttpMethodMatcherPolicy.cs (2)
399for (var i = 0; i < methods.Length; i++) 408for (var i = 0; i < methods.Length; i++)
Matching\ILEmitTrieFactory.cs (7)
128if (groups.Length < binarySearchThreshold) 132for (var i = 0; i < groups.Length; i++) 153var mid = groups.Length / 2; 348if (groups.Length < binarySearchThreshold) 368var mid = groups.Length / 2; 473if (disableBinarySearch || groups.Length < binarySearchThreshold) 500var mid = groups.Length / 2;
Microsoft.AspNetCore.Routing.Microbenchmarks (2)
Matching\JumpTableMultipleEntryBenchmark.cs (2)
161for (var c = 0; c < buffer.Length; c++) 165if (char.IsDigit(buffer[c]) && c < buffer.Length / 2)
Microsoft.AspNetCore.Server.HttpSys (17)
RequestProcessing\Response.cs (3)
299_nativeResponse.Base.EntityChunkCount = checked((ushort)dataChunks.Length); 531if (unknownHeaders.Length == 0) 562if (knownHeaderInfo.Length == 0)
RequestProcessing\ResponseBody.cs (1)
272Debug.Assert(currentChunk == dataChunks.Length, "All chunks should be accounted for");
src\Shared\HttpSys\RequestProcessing\PathNormalizer.cs (1)
18var end = start + input.Length;
src\Shared\HttpSys\RequestProcessing\RawUrlHelper.cs (4)
23if (raw[0] != '/' && !(raw.Length == 1 && raw[0] == '*')) 60while (scan < raw.Length && raw[scan] != '?') 75if (raw.Length < 7) 113if (raw.Length < 8)
src\Shared\HttpSys\RequestProcessing\RequestUriBuilder.cs (5)
22Debug.Assert(rawUrlBytes.Length != 0, "Length of the URL cannot be zero."); 25if (rawPath.Length == 0) 32if (rawPath.Length == 1 && rawPath[0] == (byte)'*') 58var end = rawPath.Length; 161if (reader == buffer.Length)
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (36)
src\Shared\Http2cat\Http2Utilities.cs (2)
285var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength); 371var payload = buffer.Slice(extendedHeaderLength, buffer.Length - padLength - extendedHeaderLength);
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\Shared\runtime\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
Microsoft.AspNetCore.Server.IIS (22)
Core\IISHttpContext.cs (2)
318if (rawUrlInBytes.Length == 0) 325if (rawUrlInBytes.Length > 0 && rawUrlInBytes[^1] == 0)
src\Shared\HttpSys\RequestProcessing\PathNormalizer.cs (1)
18var end = start + input.Length;
src\Shared\HttpSys\RequestProcessing\RawUrlHelper.cs (4)
23if (raw[0] != '/' && !(raw.Length == 1 && raw[0] == '*')) 60while (scan < raw.Length && raw[scan] != '?') 75if (raw.Length < 7) 113if (raw.Length < 8)
src\Shared\HttpSys\RequestProcessing\RequestUriBuilder.cs (5)
22Debug.Assert(rawUrlBytes.Length != 0, "Length of the URL cannot be zero."); 25if (rawPath.Length == 0) 32if (rawPath.Length == 1 && rawPath[0] == (byte)'*') 58var end = rawPath.Length; 161if (reader == buffer.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
Microsoft.AspNetCore.Server.Kestrel.Core (67)
Internal\Http\Http1Connection.cs (9)
283Debug.Assert(target.Length != 0, "Request target must be non-zero length"); 293else if (ch == ByteAsterisk && target.Length == 1) 331if (target.Length == 1) 348previousValue == null || previousValue.Length != target.Length || 379if (target.Length == targetPath.Length) 419var queryLength = query.Length; 467previousValue == null || previousValue.Length != target.Length || 525previousValue == null || previousValue.Length != target.Length || 557previousValue == null || previousValue.Length != query.Length ||
Internal\Http\HttpParser.cs (1)
436if (terminatorSize == -1 || !TryTakeSingleHeader(handler, headerSpan.Slice(0, headerSpan.Length - terminatorSize)))
Internal\Http\PathNormalizer.cs (2)
42if (path.Length == pathLength && queryLength == 0) 57var end = start + input.Length;
Internal\Infrastructure\HttpUtilities.cs (1)
105if (!StringUtilities.TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length))
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\Shared\runtime\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\Shared\runtime\Http3\Frames\Http3Frame.cs (1)
45if (buffer.Length != 0)
src\Shared\runtime\Http3\Helpers\VariableLengthIntegerHelper.cs (1)
154if (buffer.Length != 0)
src\Shared\runtime\Http3\QPack\QPackEncoder.cs (8)
69if (destination.Length >= 2) 184if (buffer.Length != 0) 195if (buffer.Length >= encodedStringLength) 233if (buffer.Length > 0) 258if (buffer.Length >= valueLength) 303Debug.Assert(buffer.Length >= s.Length); 320if (buffer.Length != 0) 328if (buffer.Length >= s.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
src\Shared\UrlDecoder\UrlDecoder.cs (7)
20if (destination.Length < source.Length) 52if (sourceIndex == buffer.Length) 155if (sourceIndex == buffer.Length) 303if (scan == buffer.Length) 385return buffer.Length; 396if (sourceIndex == buffer.Length) 491if (sourceIndex == buffer.Length)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (8)
AsciiDecoding.cs (5)
41Assert.Equal(s.Length, asciiBytes.Length); 43for (var i = 0; i < asciiBytes.Length; i++) 104Assert.False(StringUtilities.BytesOrdinalEqualsStringAndAscii(s, span.Slice(0, span.Length - 1))); 108Assert.False(StringUtilities.BytesOrdinalEqualsStringAndAscii(s, span.Slice(1, span.Length - 1))); 141for (var i = 0; i < asciiBytes.Length; i++)
src\Servers\Kestrel\shared\test\PipeWriterHttp2FrameExtensions.cs (1)
73frame.PayloadLength = headerData.Length;
TestHelpers\AssertExtensions.cs (2)
13if (expected.Length != actual.Length) 15throw new XunitException($"Expected length to be {expected.Length} but was {actual.Length}");
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
Mocks\NullParser.cs (1)
40new TargetOffsetPathLength(4, startLine.Length - 4, false),
src\Servers\Kestrel\shared\test\PipeWriterHttp2FrameExtensions.cs (1)
73frame.PayloadLength = headerData.Length;
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (3)
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
Microsoft.AspNetCore.Shared.Tests (66)
src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (1)
561for (var i = 0; i < ArrayStorageSpan.Length; ++i)
src\Shared\HttpSys\RequestProcessing\PathNormalizer.cs (1)
18var end = start + input.Length;
src\Shared\HttpSys\RequestProcessing\RawUrlHelper.cs (4)
23if (raw[0] != '/' && !(raw.Length == 1 && raw[0] == '*')) 60while (scan < raw.Length && raw[scan] != '?') 75if (raw.Length < 7) 113if (raw.Length < 8)
src\Shared\HttpSys\RequestProcessing\RequestUriBuilder.cs (5)
22Debug.Assert(rawUrlBytes.Length != 0, "Length of the URL cannot be zero."); 25if (rawPath.Length == 0) 32if (rawPath.Length == 1 && rawPath[0] == (byte)'*') 58var end = rawPath.Length; 161if (reader == buffer.Length)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\Shared\runtime\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\Shared\runtime\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\Shared\runtime\Http3\Frames\Http3Frame.cs (1)
45if (buffer.Length != 0)
src\Shared\runtime\Http3\Helpers\VariableLengthIntegerHelper.cs (1)
154if (buffer.Length != 0)
src\Shared\runtime\Http3\QPack\QPackEncoder.cs (8)
69if (destination.Length >= 2) 184if (buffer.Length != 0) 195if (buffer.Length >= encodedStringLength) 233if (buffer.Length > 0) 258if (buffer.Length >= valueLength) 303Debug.Assert(buffer.Length >= s.Length); 320if (buffer.Length != 0) 328if (buffer.Length >= s.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
120if (sourceLength <= dest.Length) 137var bytesLeftInBlock = span.Length; 212if (sourceLength <= dest.Length)
src\Shared\ServerInfrastructure\BufferWriter.cs (4)
93if (_span.Length >= source.Length) 111if (_span.Length < count) 140if (_span.Length == 0) 145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\StringUtilities.cs (3)
59if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 86if (!TryGetAsciiString((byte*)state.ToPointer(), output, buffer.Length)) 110if (!TryGetLatin1String((byte*)state.ToPointer(), output, buffer.Length))
src\Shared\UrlDecoder\UrlDecoder.cs (7)
20if (destination.Length < source.Length) 52if (sourceIndex == buffer.Length) 155if (sourceIndex == buffer.Length) 303if (scan == buffer.Length) 385return buffer.Length; 396if (sourceIndex == buffer.Length) 491if (sourceIndex == buffer.Length)
src\Shared\WebEncoders\WebEncoders.cs (1)
344Debug.Assert(output.Length >= GetArraySizeRequiredToEncode(input.Length));
Microsoft.AspNetCore.SignalR.Client.Tests (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
249Debug.Assert(span.Length >= _bytesWritten);
Microsoft.AspNetCore.SignalR.Common (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
249Debug.Assert(span.Length >= _bytesWritten);
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
249Debug.Assert(span.Length >= _bytesWritten);
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
249Debug.Assert(span.Length >= _bytesWritten);
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
249Debug.Assert(span.Length >= _bytesWritten);
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
249Debug.Assert(span.Length >= _bytesWritten);
Microsoft.AspNetCore.StaticAssets (1)
StaticAssetsInvoker.cs (1)
404for (var i = 0; i < states.Length; i++)
Microsoft.AspNetCore.StaticAssets.Tests (1)
StaticAssetsIntegrationTests.cs (1)
272for (var i = 0; i < resources.Length; i++)
Microsoft.AspNetCore.WebSockets (23)
src\Shared\ValueStringBuilder\ValueListBuilder.cs (7)
33if ((uint)pos < (uint)span.Length) 47Debug.Assert(_pos == _span.Length); 78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (16)
38Debug.Assert(value <= _chars.Length); 43public int Capacity => _chars.Length; 51if ((uint)capacity > (uint)_chars.Length) 137if (_pos > _chars.Length - count) 157if (_pos > (_chars.Length - count)) 172if ((uint)pos < (uint)_chars.Length) 192if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 206if (pos > _chars.Length - s.Length) 217if (_pos > _chars.Length - count) 223for (int i = 0; i < dst.Length; i++) 233if (pos > _chars.Length - length) 239for (int i = 0; i < dst.Length; i++) 249if (pos > _chars.Length - value.Length) 262if (origPos > _chars.Length - length) 290Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 293char[] poolArray = ArrayPool<char>.Shared.Rent((int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), (uint)_chars.Length * 2));
Microsoft.AspNetCore.WebUtilities (10)
FileBufferingReadStream.cs (1)
312else if (buffer.Length > 0)
HttpRequestStreamReader.cs (1)
172var count = buffer.Length;
src\Shared\UrlDecoder\UrlDecoder.cs (7)
20if (destination.Length < source.Length) 52if (sourceIndex == buffer.Length) 155if (sourceIndex == buffer.Length) 303if (scan == buffer.Length) 385return buffer.Length; 396if (sourceIndex == buffer.Length) 491if (sourceIndex == buffer.Length)
src\Shared\WebEncoders\WebEncoders.cs (1)
344Debug.Assert(output.Length >= GetArraySizeRequiredToEncode(input.Length));
Microsoft.Build (6)
FileUtilities.cs (3)
622for (int i = 0; i < str.Length; i++) 639int endId = path.Length - 1; 643bool hasQuotes = path.Length > 2
Logging\OptimizedStringIndenter.cs (3)
64int indentedStringLength = segments.Length * (Environment.NewLine.Length + indent); 132if (segmentCount <= segments.Length) 144for (int i = 0; i < segments.Length; i++)
Microsoft.Build.Engine.OM.UnitTests (3)
FileUtilities.cs (3)
622for (int i = 0; i < str.Length; i++) 639int endId = path.Length - 1; 643bool hasQuotes = path.Length > 2
Microsoft.Build.Framework (6)
ArraySortHelper.cs (6)
690Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 691Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 723Debug.Assert(keys.Length == values.Length); 734Debug.Assert(values.Length == keys.Length); 976Debug.Assert(values.Length == keys.Length); 1254if ((uint)i < (uint)values.Length) // check to see if we have values
Microsoft.Build.Tasks.Core (3)
FileUtilities.cs (3)
622for (int i = 0; i < str.Length; i++) 639int endId = path.Length - 1; 643bool hasQuotes = path.Length > 2
Microsoft.Build.Utilities.Core (3)
FileUtilities.cs (3)
622for (int i = 0; i < str.Length; i++) 639int endId = path.Length - 1; 643bool hasQuotes = path.Length > 2
Microsoft.Extensions.Diagnostics (1)
src\libraries\Common\src\System\Diagnostics\DiagnosticsHelper.cs (1)
127_maxIndex = bitMap.Length * sizeof(ulong) * 8;
Microsoft.Extensions.Identity.Core (8)
Base32.cs (6)
123switch (input.Length - offset) 132b1 = (offset < input.Length) ? input[offset++] : 0U; 133b2 = (offset < input.Length) ? input[offset++] : 0U; 134b3 = (offset < input.Length) ? input[offset++] : 0U; 135b4 = (offset < input.Length) ? input[offset++] : 0U; 136b5 = (offset < input.Length) ? input[offset++] : 0U;
Rfc6238AuthenticationService.cs (2)
72var combined = new byte[checked(input.Length + modifierBytes.Length)]; 74Buffer.BlockCopy(modifierBytes, 0, combined, input.Length, modifierBytes.Length);
Microsoft.Extensions.Logging.Abstractions (16)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
Microsoft.Extensions.Logging.Generators (14)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (14)
29Debug.Assert(value <= _span.Length); 50if ((uint)pos < (uint)span.Length) 66if (source.Length == 1 && (uint)pos < (uint)span.Length) 80if ((uint)(_pos + source.Length) > (uint)_span.Length) 82Grow(_span.Length - _pos + source.Length); 93if ((uint)(_pos + source.Length) > (uint)_span.Length) 110if ((ulong)(uint)pos + (ulong)(uint)length <= (ulong)(uint)span.Length) // same guard condition as in Span<T>.Slice on 64-bit 125Grow(_span.Length - pos + length); 134Debug.Assert(_pos == _span.Length); 180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
Microsoft.Net.Http.Headers (2)
HeaderUtilities.cs (2)
629var spanLength = span.Length; 699span[span.Length - 1] = span[0] = '\"';
MSBuild (3)
FileUtilities.cs (3)
622for (int i = 0; i < str.Length; i++) 639int endId = path.Length - 1; 643bool hasQuotes = path.Length > 2
PresentationFramework (3)
MS\Internal\PtsHost\ListMarkerSourceInfo.cs (2)
195result[result.Length - 1] = NumberSuffix; 196for (int i = result.Length - 2; i >= 0; --i)
System\Windows\Documents\FixedSOMTextRun.cs (1)
159for (int i = 0; i < destination.Length; i++)
ReachFramework (1)
Serialization\XpsFontSubsetter.cs (1)
693for (int i = 0; i < guidByteArray.Length; i++)
System.Collections (3)
src\libraries\Common\src\System\Collections\Generic\BitHelper.cs (2)
30if (bitArrayIndex < (uint)span.Length) 45bitArrayIndex < (uint)span.Length &&
System\Collections\BitArray.cs (1)
801Debug.Assert(span.Length > 0);
System.Collections.Immutable (14)
System\Collections\Frozen\FrozenDictionary.cs (1)
332if (destination.Length < Count)
System\Collections\Frozen\FrozenHashTable.cs (6)
59int[] arrayPoolBuckets = ArrayPool<int>.Shared.Rent(numBuckets + hashCodes.Length); 61Span<int> nexts = arrayPoolBuckets.AsSpan(numBuckets, hashCodes.Length); 68for (int index = 0; index < hashCodes.Length; index++) 71int bucketNum = (int)HashHelpers.FastMod((uint)hashCode, (uint)bucketStarts.Length, fastModMultiplier); 84var hashtableHashcodes = new int[hashCodes.Length]; 85var hashtableBuckets = new Bucket[bucketStarts.Length];
System\Collections\Frozen\Int32\Int32FrozenDictionary.cs (1)
40for (int srcIndex = 0; srcIndex < hashCodes.Length; srcIndex++)
System\Collections\Frozen\ItemsFrozenSet.cs (1)
35for (int srcIndex = 0; srcIndex < hashCodes.Length; srcIndex++)
System\Collections\Frozen\KeysAndValuesFrozenDictionary.cs (1)
37for (int srcIndex = 0; srcIndex < hashCodes.Length; srcIndex++)
System\Collections\Frozen\String\OrdinalStringFrozenDictionary.cs (1)
52for (int srcIndex = 0; srcIndex < hashCodes.Length; srcIndex++)
System\Collections\Frozen\String\OrdinalStringFrozenSet.cs (1)
43for (int srcIndex = 0; srcIndex < hashCodes.Length; srcIndex++)
System\Collections\Immutable\ImmutableArray_1.Builder.cs (1)
1017Requires.Range(this.Count <= destination.Length, nameof(destination));
System\Collections\Immutable\ImmutableArray_1.cs (1)
916Requires.Range(self.Length <= destination.Length, nameof(destination));
System.Collections.Specialized (2)
System\Collections\Specialized\BitVector32.cs (2)
166dst[dst.Length - 1] = '}'; 170for (int i = 0; i < dst.Length; i++)
System.Console (24)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\ConsolePal.Unix.cs (6)
526Debug.Assert(readBytesPos > 0 && readBytesPos <= readBytes.Length); 583if (dstPos == dst.Length) 585var tmpReadBytes = new byte[dst.Length * 2]; 618Debug.Assert(foundByteDstPos < foundByteDst.Length, "Should only be called when there's room for at least one byte."); 952int result = Interop.CheckIo(Interop.Sys.Read(fd, bufPtr, buffer.Length)); 953Debug.Assert(result <= buffer.Length);
System\IO\CachedConsoleStream.cs (1)
65if (lastNewLine + 1 < charBuffer.Length)
System\IO\StdInReader.cs (1)
77if (spaceRemaining < chars.Length)
System.Data.Common (9)
System\Data\SQLTypes\SQLBytes.cs (2)
326int count = Math.Min(buffer.Length, (int)(Length - offset)); 331return span.Length;
System\Data\SQLTypes\SQLDecimal.cs (7)
1165ArgumentOutOfRangeException.ThrowIfLessThan(destination.Length, 4, nameof(destination)); 1859Debug.Assert(rgulData.Length == s_cNumeMax, "rgulData.Length == x_cNumeMax", "Invalid array length"); 1933Debug.Assert(rglData.Length == 4, "rglData.Length == 4", $"Wrong array length: {rglData.Length}"); 2465Debug.Assert(rgulD.Length >= ciulS, "rgulD.Length >= ciulS", "Invalid array length"); 2537Debug.Assert(rgulU.Length == s_cNumeMax); 2606Debug.Assert(rgulD.Length == s_cNumeMax);
System.Diagnostics.DiagnosticSource (27)
src\libraries\Common\src\System\Diagnostics\DiagnosticsHelper.cs (1)
127_maxIndex = bitMap.Length * sizeof(ulong) * 8;
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Diagnostics\Activity.cs (5)
1908Debug.Assert(outBytes.Length == 16 || outBytes.Length == 8); 1913if (outBytes.Length == 16) 1925Debug.Assert(outBytes.Length * 2 == charData.Length); 1926for (int i = 0; i < outBytes.Length; i++)
System\Diagnostics\Metrics\AggregatorStore.cs (1)
502KeyValuePair<string, string>[] labels = new KeyValuePair<string, string>[indexedNames.Length];
System\Diagnostics\Metrics\TagList.cs (1)
227if (tags.Length < _tagsCount)
System.Diagnostics.FileVersionInfo (5)
System\Diagnostics\FileVersionInfo.Unix.cs (5)
207if (parts.Length <= 4 && parts.Length > 0) 210if (!endedEarly && parts.Length > 1) 213if (!endedEarly && parts.Length > 2) 216if (!endedEarly && parts.Length > 3)
System.Diagnostics.Process (27)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetGroupList.cs (2)
23int ngroups = groups.Length; 33else if (rv == -1 && ngroups > groups.Length)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.IsMemberOfGroup.cs (2)
30rv = Interop.Sys.GetGroups(groups.Length, pGroups); 41groups = new uint[groups.Length * 2];
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (3)
46int resultLength = ReadLink(ref pathReference, ref MemoryMarshal.GetReference(spanBuffer), spanBuffer.Length); 54else if (resultLength < spanBuffer.Length) 74arrayBuffer = ArrayPool<byte>.Shared.Rent(spanBuffer.Length * 2);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\Common\src\System\Text\ValueUtf8Converter.cs (1)
27if (_bytes.Length < maxSize)
System\Diagnostics\Process.Linux.cs (3)
277if (bytesRead == buffer.Length) 279uint newLength = (uint)buffer.Length * 2; 291Debug.Assert(bytesRead < buffer.Length);
System.Diagnostics.TextWriterTraceListener (1)
System\Diagnostics\XmlWriterTraceListener.cs (1)
411Debug.Assert(charsWritten == span.Length);
System.Formats.Asn1 (17)
System\Formats\Asn1\Asn1Tag.cs (3)
301/// <see langword="false"/> if <paramref name="destination"/>.<see cref="Span{T}.Length"/> &lt; 308if (destination.Length < spaceRequired) 360/// <paramref name="destination"/>.<see cref="Span{T}.Length"/> &lt; <see cref="CalculateEncodedSize"/>.
System\Formats\Asn1\AsnCharacterStringEncodings.cs (1)
71return encoding.GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length);
System\Formats\Asn1\AsnDecoder.BitString.cs (2)
189if (value.Length > destination.Length) 609if (dest.Length < contentLength)
System\Formats\Asn1\AsnDecoder.NamedBitList.cs (1)
395for (int byteIdx = 0; byteIdx < value.Length; byteIdx++)
System\Formats\Asn1\AsnDecoder.OctetString.cs (5)
86if (contents.Length > destination.Length) 464if (dest.Length < contentLength) 506if (tmpSpace.Length > 0 && tooBig > tmpSpace.Length) 512if (tooBig > tmpSpace.Length)
System\Formats\Asn1\AsnDecoder.Oid.cs (2)
162Debug.Assert(writeSpan.Length >= SemanticByteCount); 175int bytesWritten = tmpBytes.Length - writeSpan.Length;
System\Formats\Asn1\AsnDecoder.Text.cs (1)
354if (contents.Length > destination.Length)
System\Formats\Asn1\AsnWriter.cs (1)
134if (destination.Length < _offset)
System\Formats\Asn1\AsnWriter.Oid.cs (1)
193Debug.Assert(dest.Length > 0);
System.Formats.Cbor (6)
System\Formats\Cbor\Reader\CborReader.String.cs (4)
80if (length > destination.Length) 241if (charLength > destination.Length) 355if (concatenatedBufferSize > destination.Length) 424if (concatenatedStringSize > destination.Length)
System\Formats\Cbor\Writer\CborWriter.cs (2)
192if (encoding.Length > destination.Length) 210if (encoding.Length > destination.Length)
System.Formats.Tar (29)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Formats\Tar\SeekableSubReadStream.cs (2)
49int origCount = destination.Length; 50int count = destination.Length;
System\Formats\Tar\SubReadStream.cs (2)
111int origCount = destination.Length; 112int count = destination.Length;
System\Formats\Tar\TarHeader.Write.cs (9)
857if (span.Length < length) 961int i = destination.Length - 3; 962int j = converted.Length - 1; 984Debug.Assert(destination.Length > 1); 987int numToCopy = Math.Min(bytesToWrite.Length, destination.Length); 998Debug.Assert(destination.Length > 1); 1004int numToCopy = Math.Min(bytesToWrite.Length, destination.Length - 1); 1006int copyPos = destination.Length - 1 - bytesToWrite.Length; 1031int i = digits.Length - 1;
System.IO.Compression (14)
System\IO\Compression\DeflateManaged\DeflateManagedStream.cs (3)
105int initialLength = buffer.Length; 113if (buffer.Length == 0) 140return initialLength - buffer.Length;
System\IO\Compression\DeflateManaged\InflaterManaged.cs (1)
115bytes = bytes.Slice(0, (int)Math.Min(bytes.Length, _uncompressedSize - _currentInflatedCount));
System\IO\Compression\DeflateManaged\OutputWindow.cs (6)
125if (output.Length > _bytesUsed) 133copy_end = (_end - _bytesUsed + output.Length) & WindowMask; // copy length of bytes 136int copied = output.Length; 138int tailLen = output.Length - copy_end; 146_window.AsSpan(copy_end - output.Length, output.Length).CopyTo(output);
System\IO\Compression\DeflateZLib\Inflater.cs (2)
78if (destination.Length == 0) 83return InflateVerified(bufPtr, destination.Length);
System\IO\Compression\ZipCustomStreams.cs (2)
309int origCount = destination.Length; 310int count = destination.Length;
System.IO.Compression.Brotli (15)
System\IO\Compression\dec\BrotliDecoder.cs (6)
64nuint availableOutput = (nuint)destination.Length; 83Debug.Assert(availableOutput <= (nuint)destination.Length); 86bytesWritten += destination.Length - (int)availableOutput; 97destination = destination.Slice(destination.Length - (int)availableOutput); 119nuint availableOutput = (nuint)destination.Length; 122Debug.Assert(success ? availableOutput <= (nuint)destination.Length : availableOutput == 0);
System\IO\Compression\dec\BrotliStream.Decompress.cs (2)
225(lastResult == OperationStatus.DestinationTooSmall && destination.IsEmpty && _bufferCount == 0), $"{nameof(lastResult)} == {lastResult}, {nameof(destination.Length)} == {destination.Length}");
System\IO\Compression\enc\BrotliEncoder.cs (7)
154nuint availableOutput = (nuint)destination.Length; 172Debug.Assert(availableOutput <= (nuint)destination.Length); 175bytesWritten += destination.Length - (int)availableOutput; 178if ((int)availableOutput == destination.Length && Interop.Brotli.BrotliEncoderHasMoreOutput(_state) == Interop.BOOL.FALSE && availableInput == 0) 184destination = destination.Slice(destination.Length - (int)availableOutput); 222nuint availableOutput = (nuint)destination.Length; 225Debug.Assert(success ? availableOutput <= (nuint)destination.Length : availableOutput == 0);
System.IO.FileSystem.Watcher (16)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System.IO.Hashing (17)
System\IO\Hashing\Crc32.cs (2)
131if (destination.Length < Size) 153if (destination.Length < Size)
System\IO\Hashing\Crc64.cs (2)
129if (destination.Length < Size) 151if (destination.Length < Size)
System\IO\Hashing\NonCryptographicHashAlgorithm.cs (5)
203if (destination.Length < HashLengthInBytes) 228if (destination.Length < HashLengthInBytes) 265if (destination.Length < HashLengthInBytes) 290if (destination.Length < HashLengthInBytes) 324Debug.Assert(destination.Length == HashLengthInBytes);
System\IO\Hashing\XxHash128.cs (1)
101if (destination.Length >= sizeof(ulong) * 2)
System\IO\Hashing\XxHash3.cs (1)
101if (destination.Length >= sizeof(long))
System\IO\Hashing\XxHash32.cs (2)
203if (destination.Length < HashSize) 226if (destination.Length < HashSize)
System\IO\Hashing\XxHash64.cs (2)
203if (destination.Length < HashSize) 226if (destination.Length < HashSize)
System\IO\Hashing\XxHashShared.cs (2)
324Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 327state.BufferedCount = (uint)remaining.Length;
System.IO.Pipelines (2)
System\IO\Pipelines\Pipe.cs (1)
1107int writable = Math.Min(destination.Length, source.Length);
System\IO\Pipelines\PipeReaderStream.cs (1)
126int actual = (int)Math.Min(bufferLength, buffer.Length);
System.IO.Pipes (1)
System\IO\Pipes\PipeStream.Unix.cs (1)
261if (buffer.Length == 0)
System.Linq (17)
System\Linq\OrderedEnumerable.SpeedOpt.cs (1)
48for (int i = 0; i < destination.Length; i++)
System\Linq\Range.cs (2)
82ref int end = ref Unsafe.Add(ref pos, destination.Length); 85destination.Length >= Vector<int>.Count)
System\Linq\SegmentedArrayBuilder.cs (6)
106if ((uint)countInCurrentSegment < (uint)currentSegment.Length) 143int availableSpaceInCurrentSpan = _currentSegment.Length - _countInCurrentSegment; 161bool currentSegmentIsScratchBufferWithRemainingSpace = _segmentsCount == 0 && _countInCurrentSegment < _currentSegment.Length; 168int remainingSpaceInCurrentSegment = _currentSegment.Length - _countInCurrentSegment; 218if ((uint)countInCurrentSegment < (uint)currentSegment.Length) 320int currentSegmentLength = _currentSegment.Length;
System\Linq\Select.SpeedOpt.cs (6)
160for (int i = 0; i < destination.Length; i++) 286for (int i = 0; i < results.Length; i++, start++) 386for (int i = 0; i < destination.Length; i++) 489for (int i = 0; i < results.Length; i++) 734Debug.Assert(index == results.Length, "All list elements were not initialized."); 902for (int i = 0; i < destination.Length; i++, sourceIndex++)
System\Linq\SingleLinkedNode.cs (1)
119int index = span.Length;
System\Linq\SkipTake.SpeedOpt.cs (1)
151for (int i = 0; i < destination.Length; i++, sourceIndex++)
System.Memory (14)
System\Buffers\BuffersExtensions.cs (4)
68if (span.Length > destination.Length) 80if (sequence.Length > destination.Length) 121if (value.Length <= destination.Length) 137int writeSize = Math.Min(destination.Length, input.Length);
System\Buffers\SequenceReader.cs (6)
417if (firstSpan.Length >= destination.Length) 419firstSpan.Slice(0, destination.Length).CopyTo(destination); 430if (Remaining < destination.Length) 434Debug.Assert(firstSpan.Length < destination.Length); 444int toCopy = Math.Min(nextSpan.Length, destination.Length - copied); 447if (copied >= destination.Length)
System\Text\EncodingExtensions.cs (4)
116int originalBytesLength = bytes.Length; 130return originalBytesLength - bytes.Length; // total number of bytes we wrote 307int originalCharsLength = chars.Length; 321return originalCharsLength - chars.Length; // total number of chars we wrote
System.Memory.Data (5)
src\libraries\Common\src\System\IO\ReadOnlyMemoryStream.cs (5)
108if (remaining <= 0 || buffer.Length == 0) 112else if (remaining <= buffer.Length) 120_content.Span.Slice(_position, buffer.Length).CopyTo(buffer); 121_position += buffer.Length; 122return buffer.Length;
System.Net.Http (107)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\IO\ReadOnlyMemoryStream.cs (5)
108if (remaining <= 0 || buffer.Length == 0) 112else if (remaining <= buffer.Length) 120_content.Span.Slice(_position, buffer.Length).CopyTo(buffer); 121_position += buffer.Length; 122return buffer.Length;
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackEncoder.cs (19)
34if (destination.Length != 0) 90if ((uint)destination.Length >= 2) 122if ((uint)destination.Length >= 2) 154if ((uint)destination.Length >= 2) 192if ((uint)destination.Length != 0) 272if ((uint)destination.Length >= 3) 305if ((uint)destination.Length >= 3) 344if ((uint)destination.Length >= 2) 371if (destination.Length != 0) 379if (value.Length <= destination.Length) 397Debug.Assert(destination.Length >= value.Length); 421if (destination.Length != 0) 429if (value.Length <= destination.Length) 460if (destination.Length != 0) 472if (encodedStringLength <= destination.Length) 503if (destination.Length != 0) 526if (destination.Length != 0) 553if (destination.Length >= valueLength) 639span = new byte[span.Length * 2];
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\Huffman.cs (5)
680Debug.Assert(dst.Length > 0); 712if (j == dst.Length) 714Array.Resize(ref dstArray, dst.Length * 2); 779if (j == dst.Length) 781Array.Resize(ref dstArray, dst.Length * 2);
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\IntegerEncoder.cs (3)
28if (destination.Length == 0) 47if (1 == destination.Length) 60if (i >= destination.Length)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\Frames\Http3Frame.cs (1)
45if (buffer.Length != 0)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\Helpers\VariableLengthIntegerHelper.cs (1)
154if (buffer.Length != 0)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackEncoder.cs (8)
69if (destination.Length >= 2) 184if (buffer.Length != 0) 195if (buffer.Length >= encodedStringLength) 233if (buffer.Length > 0) 258if (buffer.Length >= valueLength) 303Debug.Assert(buffer.Length >= s.Length); 320if (buffer.Length != 0) 328if (buffer.Length >= s.Length)
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (1)
387if (destination.Length < _length)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Net\Http\MultipartContent.cs (1)
492if (buffer.Length == 0)
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (10)
37if (buffer.Length == 0) 64buffer.Length >= _connection.ReadBufferSize && 72Debug.Assert(buffer.Length != 0); 73int bytesRead = _connection.Read(buffer.Slice(0, (int)Math.Min((ulong)buffer.Length, _chunkBytesRemaining))); 86if (buffer.Length == 0) 101if (buffer.Length == 0) 296Debug.Assert(buffer.Length > 0); 298while (buffer.Length > 0) 300if (ReadChunkFromConnectionBuffer(buffer.Length, cancellationRegistration) is not ReadOnlyMemory<byte> bytesRead || bytesRead.Length == 0) 305Debug.Assert(bytesRead.Length <= buffer.Length);
System\Net\Http\SocketsHttpHandler\ConnectionCloseReadStream.cs (1)
28if (bytesRead == 0 && buffer.Length != 0)
System\Net\Http\SocketsHttpHandler\ContentLengthReadStream.cs (2)
32if ((ulong)buffer.Length > _contentBytesRemaining) 38if (bytesRead <= 0 && buffer.Length != 0)
System\Net\Http\SocketsHttpHandler\DecompressionHandler.cs (1)
369if (buffer.Length != 0)
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (2)
1673Debug.Assert(span.Length == 0); 1938Debug.Assert(destination.Length >= Size);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (2)
1116int bytesRead = Math.Min(buffer.Length, activeBuffer.Length); 1153else if (buffer.Length != 0)
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (4)
1115int copyLen = (int)Math.Min(buffer.Length, Math.Min(_responseDataPayloadRemaining, _recvBuffer.ActiveLength)); 1135int copyLen = (int)Math.Min(buffer.Length, _responseDataPayloadRemaining); 1138if (bytesRead == 0 && buffer.Length != 0) 1152while (buffer.Length != 0);
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (21)
1001int length = (uint)carriageReturnIndex < (uint)buffer.Length && buffer[carriageReturnIndex] == '\r' 1010if (_allowedReadLineBytes <= buffer.Length) 1025if (line.Length < MinStatusLineLength || line[8] != ' ') 1061if (line.Length == MinStatusLineLength) 1097int bytesScanned = finished ? bytesConsumed : buffer.Length; 1112int originalBufferLength = buffer.Length; 1119return (finished: false, bytesConsumed: originalBufferLength - buffer.Length); 1126return (finished: true, bytesConsumed: originalBufferLength - buffer.Length + colIdx + 1); 1133if ((uint)valueStartIdx >= (uint)buffer.Length) 1135return (finished: false, bytesConsumed: originalBufferLength - buffer.Length); 1145if ((uint)lfIdx >= (uint)valueIterator.Length) 1147return (finished: false, bytesConsumed: originalBufferLength - buffer.Length); 1151int crOrLfIdx = (uint)crIdx < (uint)valueIterator.Length && valueIterator[crIdx] == '\r' 1156if ((uint)spIdx >= (uint)valueIterator.Length) 1158return (finished: false, bytesConsumed: originalBufferLength - buffer.Length); 1168ReadOnlySpan<byte> headerValue = buffer.Slice(valueStartIdx, buffer.Length - valueIterator.Length + crOrLfIdx - valueStartIdx); 1172buffer = buffer.Slice(buffer.Length - valueIterator.Length + spIdx); 1709int toCopy = Math.Min(available.Length, buffer.Length); 1770if (destination.Length == 0)
System\Net\Http\SocketsHttpHandler\RawConnectionStream.cs (1)
34if (bytesRead == 0 && buffer.Length != 0)
System.Net.HttpListener (5)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Net\WebHeaderEncoding.cs (1)
32int byteCount = buffer.Length;
System\Net\HttpListener.cs (1)
206toLowerLength = destination.Length;
System.Net.Mail (20)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Net\Mail\SmtpNegotiateAuthenticationModule.cs (1)
154if (unwrappedChallenge.Length != 4 || (unwrappedChallenge[0] & 1) != 1)
System.Net.NameResolution (7)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (7)
81err = Interop.Sys.SetAddressFamily(rawAddress, buffer.Length, (int)family); 106err = Interop.Sys.SetPort(rawAddress, buffer.Length, port); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope); 144err = Interop.Sys.SetIPv4Address(rawAddress, buffer.Length, address); 161SetIPv6Address(buffer, rawInput, address.Length, scope); 170err = Interop.Sys.SetIPv6Address(rawAddress, buffer.Length, address, addressLength, scope); 181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System.Net.NetworkInformation (4)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
System\Net\NetworkInformation\UnicastIPAddressInformation.cs (1)
80Debug.Assert(prefixLength <= (addressBytes.Length * 8));
System.Net.Ping (9)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (7)
81err = Interop.Sys.SetAddressFamily(rawAddress, buffer.Length, (int)family); 106err = Interop.Sys.SetPort(rawAddress, buffer.Length, port); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope); 144err = Interop.Sys.SetIPv4Address(rawAddress, buffer.Length, address); 161SetIPv6Address(buffer, rawInput, address.Length, scope); 170err = Interop.Sys.SetIPv6Address(rawAddress, buffer.Length, address, addressLength, scope); 181buffer[0] = (byte)Math.Min(buffer.Length, 255);
src\libraries\Common\src\System\Text\ValueUtf8Converter.cs (1)
27if (_bytes.Length < maxSize)
System\Net\NetworkInformation\Ping.RawSocket.cs (1)
291header.SocketAddressLen = socketAddress.Length;
System.Net.Primitives (19)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Net\IPv4AddressHelper.Common.cs (1)
23for (int i = 0; i < numbers.Length; ++i)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (7)
81err = Interop.Sys.SetAddressFamily(rawAddress, buffer.Length, (int)family); 106err = Interop.Sys.SetPort(rawAddress, buffer.Length, port); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope); 144err = Interop.Sys.SetIPv4Address(rawAddress, buffer.Length, address); 161SetIPv6Address(buffer, rawInput, address.Length, scope); 170err = Interop.Sys.SetIPv6Address(rawAddress, buffer.Length, address, addressLength, scope); 181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System\Net\CookieContainer.cs (2)
613if (ipParts.Length == 4 && hostSpan[ipParts[0]] is "127") 616for (i = 1; i < ipParts.Length; i++)
System\Net\IPAddress.cs (5)
277if (destination.Length < IPAddressParserStatics.IPv6AddressBytes) 288if (destination.Length < IPAddressParserStatics.IPv4AddressBytes) 450if (destination.Length >= IPAddressParser.MaxIPv4StringLength) 458if (destination.Length >= IPAddressParser.MaxIPv6StringLength) 466Debug.Assert(tmpDestination.Length >= IPAddressParser.MaxIPv4StringLength);
System\Net\IPAddressParser.cs (1)
193pos += used.Length;
System.Net.Quic (22)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs (2)
29return BioGets(b, pBuf, buf.Length); 38internal static int BioRead(SafeBioHandle b, Span<byte> data) => BioRead(b, data, data.Length);
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Net\IPv4AddressHelper.Common.cs (1)
23for (int i = 0; i < numbers.Length; ++i)
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (1)
387if (destination.Length < _length)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (7)
81err = Interop.Sys.SetAddressFamily(rawAddress, buffer.Length, (int)family); 106err = Interop.Sys.SetPort(rawAddress, buffer.Length, port); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope); 144err = Interop.Sys.SetIPv4Address(rawAddress, buffer.Length, address); 161SetIPv6Address(buffer, rawInput, address.Length, scope); 170err = Interop.Sys.SetIPv6Address(rawAddress, buffer.Length, address, addressLength, scope); 181buffer[0] = (byte)Math.Min(buffer.Length, 255);
src\libraries\Common\src\System\Net\StreamBuffer.cs (1)
205int bytesRead = Math.Min(buffer.Length, _buffer.ActiveMemory.Length);
System\Net\Quic\Internal\ReceiveBuffers.cs (4)
56if (totalLength < quicBuffer.Length) 61_buffer.Commit(quicBuffer.Length); 62totalCopied += quicBuffer.Length; 63totalLength -= quicBuffer.Length;
System\Net\Quic\QuicConnection.SslConnectionOptions.cs (1)
206if (chainData.Length > 0)
System\Net\Quic\QuicStream.Stream.cs (2)
118byte[] rentedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 126int readLength = ReadAsync(new Memory<byte>(rentedBuffer, 0, buffer.Length), cts?.Token ?? default).AsTask().GetAwaiter().GetResult();
System.Net.Requests (1)
System\Net\HttpWebResponse.cs (1)
402int readBytes = innerStream.Read(buffer.Slice(0, Math.Min(buffer.Length, maxSize)));
System.Net.Security (24)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs (2)
29return BioGets(b, pBuf, buf.Length); 38internal static int BioRead(SafeBioHandle b, Span<byte> data) => BioRead(b, data, data.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (4)
172Ssl.SslCtxSetCaching(sslCtx, 1, s_cacheSize, contextId.Length, contextId, null, null); 571int retVal = Ssl.SslRead(context, ref MemoryMarshal.GetReference(buffer), buffer.Length, out errorCode); 669while (clientList.Length > 0) 764Debug.Assert(buffer.Length >= count);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (3)
209Debug.Assert(GetAlpnProtocolListSerializedLength(applicationProtocols) == buffer.Length, 233return SslSetAlpnProtos(ssl, pBuffer, serializedProtocols.Length); 249return SslAddClientCAs(ssl, pHandles, x509handles.Length);
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Net\IPv4AddressHelper.Common.cs (1)
23for (int i = 0; i < numbers.Length; ++i)
src\libraries\Common\src\System\Net\Security\MD4.cs (3)
65Debug.Assert(destination.Length == 128 >> 3); 173for (int i = 0, j = 0; j < output.Length; i++, j += 4) 181for (int i = 0, j = 0; i < output.Length; i++, j += 4)
src\libraries\Common\src\System\Net\Security\RC4.cs (1)
78Debug.Assert(input.Length == output.Length);
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (6)
298Debug.Assert(asBytes.Length == sizeof(NegotiateMessage)); 401Debug.Assert(clientChallenge.Length == ChallengeLength); 424SetField(ref field, blob.Length, payloadOffset); 426payloadOffset += blob.Length; 811unwrappedLength = input.Length - SignatureLength; 818if (input.Length < SignatureLength)
System\Net\Security\SslStream.cs (1)
777PoolingPointerMemoryManager memoryManager = RentPointerMemoryManager(ref _readPointerMemoryManager, ptr, buffer.Length);
System.Net.Sockets (30)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (7)
81err = Interop.Sys.SetAddressFamily(rawAddress, buffer.Length, (int)family); 106err = Interop.Sys.SetPort(rawAddress, buffer.Length, port); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope); 144err = Interop.Sys.SetIPv4Address(rawAddress, buffer.Length, address); 161SetIPv6Address(buffer, rawInput, address.Length, scope); 170err = Interop.Sys.SetIPv6Address(rawAddress, buffer.Length, address, addressLength, scope); 181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System\Net\Sockets\Socket.cs (6)
142int bufferLength = buffer.Length; 151Debug.Assert(bufferLength <= buffer.Length); 183bufferLength = buffer.Length; 302int size = buffer.Length; 350int size = buffer.Length; 2175int realOptionLength = optionValue.Length;
System\Net\Sockets\SocketAsyncContext.Unix.cs (2)
1603Length = buffer.Length, 1817Length = buffer.Length,
System\Net\Sockets\SocketPal.Unix.cs (15)
110received = Interop.Sys.Read(handle, b, buffer.Length); 128buffer.Length, 152Count = (UIntPtr)buffer.Length 155Debug.Assert(socketAddress.Length != 0 || sockAddr == null); 159SocketAddressLen = socketAddress.Length, 401int sockAddrLen = socketAddress.Length; 485Count = (UIntPtr)buffer.Length 488Debug.Assert(socketAddress.Length != 0 || rawSocketAddress == null); 492SocketAddressLen = socketAddress.Length, 518socketAddressLen = socketAddress.Length; 561SocketAddressLen = socketAddress.Length, 584socketAddressLen = socketAddress.Length; 754else if (buffer.Length == 0) 822else if (buffer.Length == 0) 1630Debug.Assert((uint)optionLength <= optionValue.Length);
System.Net.WebClient (3)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
System.Net.WebSockets (18)
System\Net\WebSockets\Compression\WebSocketDeflater.cs (7)
95Debug.Assert(written == output.Length); 133_stream.AvailOut = (uint)output.Length; 141written = output.Length - (int)_stream.AvailOut; 149|| written == output.Length; 157Debug.Assert(output.Length > 0); 165_stream.AvailOut = (uint)output.Length; 188return output.Length - (int)_stream.AvailOut;
System\Net\WebSockets\Compression\WebSocketInflater.cs (7)
130if (_available > 0 && output.Length > 0) 171if (output.Length == written) 181if (output.Length > written) 188if (written < output.Length || IsFinished(_stream, out _remainingByte)) 230Debug.Assert(destination.Length > 0); 236stream.AvailOut = (uint)destination.Length; 242return destination.Length - (int)stream.AvailOut;
System\Net\WebSockets\ManagedWebSocket.cs (4)
826int limit = (int)Math.Min(header.Compressed ? _inflater!.Span.Length : payloadBuffer.Length, header.PayloadLength); 1494byte* toMaskEnd = toMaskBeg + toMask.Length; 1560for (int i = 0; i < span.Length;) 1603while (state.AdditionalBytesExpected > 0 && i < span.Length)
System.Numerics.Tensors (14)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBinaryOperator.cs (2)
68if (x.Length > destination.Length) 1402if (x.Length > destination.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IStatefulUnaryOperator.cs (1)
36if (x.Length > destination.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.ITernaryOperator.cs (3)
42if (x.Length > destination.Length) 1519if (x.Length > destination.Length) 2998if (x.Length > destination.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryInputBinaryOutput.cs (2)
29if (x.Length > destination1.Length) 34if (x.Length > destination2.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOneToTwoOperator.cs (1)
37if (x.Length > destination.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOperator.cs (1)
72if (x.Length > destination.Length)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryTwoToOneOperator.cs (1)
37if (x.Length > destination.Length)
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertHelpers.cs (1)
23if (source.Length > destination.Length)
System\Numerics\Tensors\netcore\TensorPrimitives.SoftMax.cs (1)
32if (x.Length > destination.Length)
System\Numerics\Tensors\TensorPrimitives.Single.cs (1)
855if (x.Length > destination.Length)
System.Private.CoreLib (538)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.IsMemberOfGroup.cs (2)
30rv = Interop.Sys.GetGroups(groups.Length, pGroups); 41groups = new uint[groups.Length * 2];
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadDir.cs (1)
38Debug.Assert(buffer.Length >= Encoding.UTF8.GetMaxCharCount(NameBufferSize - 1 - 1));
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (3)
46int resultLength = ReadLink(ref pathReference, ref MemoryMarshal.GetReference(spanBuffer), spanBuffer.Length); 54else if (resultLength < spanBuffer.Length) 74arrayBuffer = ArrayPool<byte>.Shared.Rent(spanBuffer.Length * 2);
src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (2)
46int length = FormatMessage(flags, moduleHandle, unchecked((uint)errorCode), 0, bufferPtr, stackBuffer.Length, IntPtr.Zero); 79int length = buffer.Length;
src\libraries\Common\src\System\Collections\Generic\BitHelper.cs (2)
30if (bitArrayIndex < (uint)span.Length) 45bitArrayIndex < (uint)span.Length &&
src\libraries\Common\src\System\HexConverter.cs (4)
165Debug.Assert(chars.Length >= bytes.Length * 2); 248Debug.Assert(chars.Length <= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Number.Formatting.Common.cs (2)
502if (thousandsSepCtr >= thousandsSepPos.Length) 504var newThousandsSepPos = new int[thousandsSepPos.Length * 2];
src\libraries\Common\src\System\Number.NumberBuffer.cs (4)
54DigitsLength = digits.Length; 71for (numDigits = 0; numDigits < Digits.Length; numDigits++) 84Debug.Assert(numDigits < Digits.Length, "Null terminator not found in Number"); 99for (int i = 0; i < Digits.Length; i++)
src\libraries\Common\src\System\Number.Parsing.Common.cs (1)
95int maxDigCount = number.Digits.Length - 1;
src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (2)
256if (parts.Length is < 2 or > 4) 262for (int i = 0; i < parts.Length; i++)
src\libraries\Common\src\System\Sha1ForNonSecretPurposes.cs (2)
96int end = output.Length < 20 ? output.Length : 20;
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\Common\src\System\Text\ValueUtf8Converter.cs (1)
27if (_bytes.Length < maxSize)
src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (13)
47if (destination.Length < sizeof(byte)) 74if (destination.Length < sizeof(char)) 101if (destination.Length < sizeof(short)) 128if (destination.Length < sizeof(int)) 155if (destination.Length < sizeof(long)) 182if (destination.Length < Int128.Size) 211if (destination.Length < sizeof(ushort)) 240if (destination.Length < sizeof(uint)) 269if (destination.Length < sizeof(ulong)) 298if (destination.Length < UInt128.Size) 325if (destination.Length < sizeof(Half)) 352if (destination.Length < sizeof(float)) 379if (destination.Length < sizeof(double))
src\libraries\System.Private.CoreLib\src\System\Boolean.cs (2)
99if (destination.Length > 3) 109if (destination.Length > 4)
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (2)
289if (destination.Length < source.Length) 381if (destination.Length < source.Length)
src\libraries\System.Private.CoreLib\src\System\Buffers\MemoryManager.cs (1)
16public virtual Memory<T> Memory => new Memory<T>(this, GetSpan().Length);
src\libraries\System.Private.CoreLib\src\System\Buffers\StandardFormat.cs (2)
160Debug.Assert(destination.Length == FormatStringLength); 164if (symbol != default && destination.Length == FormatStringLength)
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Decoder.cs (5)
53int destLength = bytes.Length; 378uint bufferLength = (uint)buffer.Length; 485for (; encodedIdx < utf8.Length && (uint)bufferIdx < (uint)buffer.Length; ++encodedIdx) 581while (sourceIndex < (uint)utf8.Length) 587if (sourceIndex >= (uint)utf8.Length) // TODO https://github.com/dotnet/runtime/issues/83349: move into the while condition once fixed
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Encoder.cs (2)
51int destLength = utf8.Length; 203if (buffer.Length < encodedLength)
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Number.cs (1)
61int maxDigitCount = digits.Length - 1;
src\libraries\System.Private.CoreLib\src\System\Byte.cs (2)
371if (destination.Length >= sizeof(byte)) 389if (destination.Length >= sizeof(byte))
src\libraries\System.Private.CoreLib\src\System\Char.cs (2)
1284if (destination.Length >= sizeof(char)) 1302if (destination.Length >= sizeof(char))
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ArraySortHelper.cs (44)
125if (keys.Length > 1) 127IntroSort(keys, 2 * (BitOperations.Log2((uint)keys.Length) + 1), comparer); 140int partitionSize = keys.Length; 181Debug.Assert(keys.Length >= Array.IntrosortSizeThreshold); 184int hi = keys.Length - 1; 222int n = keys.Length; 260for (int i = 0; i < keys.Length - 1; i++) 289if (keys.Length > 1) 299if (nanLeft == keys.Length) 306IntroSort(keys, 2 * (BitOperations.Log2((uint)keys.Length) + 1)); 416int partitionSize = keys.Length; 460Debug.Assert(keys.Length >= Array.IntrosortSizeThreshold); 464ref T lastRef = ref Unsafe.Add(ref zeroRef, keys.Length - 1); 465ref T middleRef = ref Unsafe.Add(ref zeroRef, (keys.Length - 1) >> 1); 471ref T nextToLastRef = ref Unsafe.Add(ref zeroRef, keys.Length - 2); 512int n = keys.Length; 548for (int i = 0; i < keys.Length - 1; i++) 637Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 638Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 670Debug.Assert(keys.Length == values.Length); 672if (keys.Length > 1) 674IntroSort(keys, values, 2 * (BitOperations.Log2((uint)keys.Length) + 1), comparer); 681Debug.Assert(values.Length == keys.Length); 685int partitionSize = keys.Length; 726Debug.Assert(keys.Length >= Array.IntrosortSizeThreshold); 729int hi = keys.Length - 1; 767int n = keys.Length; 811for (int i = 0; i < keys.Length - 1; i++) 841if (keys.Length > 1) 851if (nanLeft == keys.Length) 859IntroSort(keys, values, 2 * (BitOperations.Log2((uint)keys.Length) + 1)); 911Debug.Assert(values.Length == keys.Length); 914int partitionSize = keys.Length; 955Debug.Assert(keys.Length >= Array.IntrosortSizeThreshold); 957int hi = keys.Length - 1; 1002int n = keys.Length; 1042for (int i = 0; i < keys.Length - 1; i++) 1118for (int i = 0; i < keys.Length; i++) 1128if ((uint)i < (uint)values.Length) // check to see if we have values
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (14)
29Debug.Assert(value <= _span.Length); 50if ((uint)pos < (uint)span.Length) 66if (source.Length == 1 && (uint)pos < (uint)span.Length) 80if ((uint)(_pos + source.Length) > (uint)_span.Length) 82Grow(_span.Length - _pos + source.Length); 93if ((uint)(_pos + source.Length) > (uint)_span.Length) 110if ((ulong)(uint)pos + (ulong)(uint)length <= (ulong)(uint)span.Length) // same guard condition as in Span<T>.Slice on 64-bit 125Grow(_span.Length - pos + length); 134Debug.Assert(_pos == _span.Length); 180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\libraries\System.Private.CoreLib\src\System\Convert.Base64.cs (1)
37int destLength = bytes.Length;
src\libraries\System.Private.CoreLib\src\System\Convert.cs (11)
2302int i = chars.Length; 2445if (charLengthRequired > chars.Length) 2478Debug.Assert(chars.Length >= charLengthRequired); 2765Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 2774if (charsWritten == tempBuffer.Length) 3004if (destination.Length < quotient) 3006source = source.Slice(0, destination.Length * 2); 3007quotient = destination.Length; 3013destination = destination.Slice(0, destination.Length - 1); 3094else if (source.Length > int.MaxValue / 2 || destination.Length > source.Length * 2) 3171else if (source.Length > int.MaxValue / 2 || destination.Length > source.Length * 2)
src\libraries\System.Private.CoreLib\src\System\DateOnly.cs (2)
758Debug.Assert(charsWritten == destination.Length); 765Debug.Assert(charsWritten == destination.Length);
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (7)
593if (destination.Length <= 3) 614if (destination.Length <= 3) 630Debug.Assert(buffer.Length >= 16, "buffer.Length >= 16"); 1147if (destination.Length >= sizeof(sbyte)) 1165if (destination.Length >= sizeof(sbyte)) 1183if (destination.Length >= (sizeof(uint) + sizeof(ulong))) 1212if (destination.Length >= (sizeof(ulong) + sizeof(uint)))
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipe.cs (1)
133return Enable(outputFilePath, format, circularBufferSizeInMB, providersNativePointer, (uint)providersNative.Length);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventProvider.cs (3)
526if (refObjIndex >= dataRefObj.Length) 528Span<object?> newDataRefObj = new object?[dataRefObj.Length * 2]; 532Span<int> newRefObjPosition = new int[refObjPosition.Length * 2];
src\libraries\System.Private.CoreLib\src\System\Double.cs (4)
728if (destination.Length >= sizeof(short)) 752if (destination.Length >= sizeof(short)) 776if (destination.Length >= sizeof(ulong)) 800if (destination.Length >= sizeof(ulong))
src\libraries\System.Private.CoreLib\src\System\Enum.cs (2)
1557if (Unsafe.SizeOf<TStorage>() * 2 <= destination.Length) 1994if (length <= destination.Length)
src\libraries\System.Private.CoreLib\src\System\Environment.Variables.Windows.cs (2)
37uint length = Interop.Kernel32.GetEnvironmentVariable(variable, ref MemoryMarshal.GetReference(span), (uint)span.Length); 38return length > 0 && length <= span.Length ?
src\libraries\System.Private.CoreLib\src\System\Exception.cs (1)
175Debug.Assert(resultSpan.Length == 0);
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Icu.cs (2)
129return Interop.Globalization.GetCalendarInfo(locale, id, type, bufferPtr, buffer.Length); 222Debug.Assert(index + 3 < modifiedPattern.Length);
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (7)
786actualSortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pDest, destination.Length, options); 792if ((uint)actualSortKeyLength > (uint)destination.Length) 794if (actualSortKeyLength > destination.Length) 908sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options); 912if (sortKeyLength > sortKey.Length) // slow path for big strings 931sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options); 937if (sortKeyLength == 0 || sortKeyLength > sortKey.Length) // internal error (0) or a bug (2nd call failed) in ucol_getSortKey
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Invariant.cs (3)
46Debug.Assert(sortKey.Length >= source.Length * sizeof(char)); 58Debug.Assert(sortKey.Length >= source.Length * sizeof(char)); 92if ((uint)destination.Length < (uint)source.Length * sizeof(char))
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Nls.cs (2)
497pSortKey, destination.Length, 519Debug.Assert(actualSortKeyLength <= destination.Length);
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.Icu.cs (1)
77if (buffer.Length - bufferIndex >= length + 1)
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (9)
1318if (destination.Length < 16) 1345if (destination.Length < 8) 1371if (destination.Length < 10) 1397if (destination.Length < 16) 1462if (destination.Length < charsRequired) 1521if (destination.Length < FormatSLength) 1556if (destination.Length < FormatuLength) 1597if (destination.Length < FormatRLength) 1668if (destination.Length < bytesRequired)
src\libraries\System.Private.CoreLib\src\System\Globalization\InvariantModeCasing.cs (2)
114Debug.Assert(source.Length <= destination.Length); 140Debug.Assert(source.Length <= destination.Length);
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Icu.cs (2)
69realLen = Interop.Globalization.NormalizeString(normalizationForm, pInput, strInput.Length, pDest, buffer.Length); 78if (realLen <= buffer.Length)
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (2)
85realLength = Interop.Normaliz.NormalizeString(normalizationForm, pInput, strInput.Length, pDest, buffer.Length); 100Debug.Assert(realLength > buffer.Length, "Buffer overflow should have iLength > cBuffer.Length");
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (1)
692if (destination.Length < source.Length)
src\libraries\System.Private.CoreLib\src\System\Globalization\TextInfo.cs (3)
214Debug.Assert(destination.Length >= source.Length); 221Debug.Assert(destination.Length >= source.Length); 255ChangeCaseCore(pSource + charsConsumed, source.Length - charsConsumed, pDestination + charsConsumed, destination.Length - charsConsumed, toUpper);
src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanFormat.cs (1)
226if (destination.Length < requiredOutputLength)
src\libraries\System.Private.CoreLib\src\System\Guid.cs (4)
882if (destination.Length < 16) 901if (destination.Length < 16) 1250if ((byte)flags > destination.Length) 1374if (destination.Length < 68)
src\libraries\System.Private.CoreLib\src\System\Half.cs (4)
1370if (destination.Length >= sizeof(sbyte)) 1388if (destination.Length >= sizeof(sbyte)) 1406if (destination.Length >= sizeof(ushort)) 1430if (destination.Length >= sizeof(ushort))
src\libraries\System.Private.CoreLib\src\System\Int16.cs (2)
468if (destination.Length >= sizeof(short)) 486if (destination.Length >= sizeof(short))
src\libraries\System.Private.CoreLib\src\System\Int32.cs (2)
501if (destination.Length >= sizeof(int)) 519if (destination.Length >= sizeof(int))
src\libraries\System.Private.CoreLib\src\System\Int64.cs (2)
498if (destination.Length >= sizeof(long)) 516if (destination.Length >= sizeof(long))
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (2)
509if (destination.Length >= sizeof(nint_t)) 532if (destination.Length >= sizeof(nint_t))
src\libraries\System.Private.CoreLib\src\System\IO\BinaryReader.cs (3)
326int numBytes = buffer.Length; 458Debug.Assert(buffer.Length != 1, "length of 1 should use ReadByte."); 464return Unsafe.As<MemoryStream>(_stream).InternalReadSpan(buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (1)
196if (maxByteCount > buffer.Length)
src\libraries\System.Private.CoreLib\src\System\IO\BufferedStream.cs (3)
448int readbytes = Math.Min(_readLen - _readPos, destination.Length); 536if (bytesFromBuffer == destination.Length) 558if (destination.Length >= _bufferSize)
src\libraries\System.Private.CoreLib\src\System\IO\Directory.Unix.cs (1)
56return Encoding.UTF8.GetString(path.Slice(0, path.Length - 1)); // trim off the trailing '\0'
src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEntry.Unix.cs (2)
82Debug.Assert(Directory.Length + FileName.Length < _pathBuffer.Length, 83$"directory ({Directory.Length} chars) & name ({Directory.Length} chars) too long for buffer ({_pathBuffer.Length} chars)");
src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemName.cs (3)
253if (currentMatch >= currentMatches.Length - 2) 255int newSize = currentMatches.Length * 2; 390int previousLength = priorMatches.Length;
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (5)
1233if (bytesRead == buffer.Length) 1235uint newLength = (uint)buffer.Length * 2; 1238newLength = (uint)Math.Max(Array.MaxLength, buffer.Length + 1); 1251Debug.Assert(bytesRead < buffer.Length); 1313fileOffset += toStore.Length;
src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (1)
357int n = Math.Min(_length - _position, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\Path.cs (5)
592if (destination.Length < pathToUse.Length) 604if (destination.Length < charsNeeded) 636if (destination.Length < charsNeeded) 782Debug.Assert(fourth.Length == destination.Length); 801Debug.Assert(chars.Length == 12, $"Unexpected {nameof(chars)}.Length");
src\libraries\System.Private.CoreLib\src\System\IO\Path.Unix.cs (1)
127return Encoding.UTF8.GetString(path.Slice(0, path.Length - 1)); // trim off the trailing '\0'
src\libraries\System.Private.CoreLib\src\System\IO\RandomAccess.Unix.cs (3)
36result = Interop.Sys.PRead(handle, bufPtr, buffer.Length, fileOffset); 47result = Interop.Sys.Read(handle, bufPtr, buffer.Length); 53result = Interop.Sys.Read(handle, bufPtr, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (4)
178if (!_strategy.CanSeek || (destination.Length >= _bufferSize)) 207if (n > destination.Length) 209n = destination.Length; 231if (n < destination.Length && !isBlocked)
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (6)
790byte[] sharedBuffer = ArrayPool<byte>.Shared.Rent(buffer.Length); 793int numRead = Read(sharedBuffer, 0, buffer.Length); 794if ((uint)numRead > (uint)buffer.Length) 826_ = ReadAtLeastCore(buffer, buffer.Length, throwOnEndOfStream: true); 888ValidateReadAtLeastArguments(buffer.Length, minimumBytes); 896Debug.Assert(minimumBytes <= buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (5)
375int count = buffer.Length; 456} while (i > 0 && n < buffer.Length); 694readToUserBuffer = userBuffer.Length >= _maxCharsPerBuffer; 747readToUserBuffer = userBuffer.Length >= _maxCharsPerBuffer; 783_isBlocked &= charsRead < userBuffer.Length;
src\libraries\System.Private.CoreLib\src\System\IO\StringReader.cs (2)
133if (n > buffer.Length) 135n = buffer.Length;
src\libraries\System.Private.CoreLib\src\System\IO\TextReader.cs (6)
98char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 102int numRead = Read(array, 0, buffer.Length); 103if ((uint)numRead > (uint)buffer.Length) 148char[] array = ArrayPool<char>.Shared.Rent(buffer.Length); 152int numRead = ReadBlock(array, 0, buffer.Length); 153if ((uint)numRead > (uint)buffer.Length)
src\libraries\System.Private.CoreLib\src\System\IO\UnmanagedMemoryStream.cs (1)
371long n = Math.Min(len - pos, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\Memory.cs (1)
321lengthOfUnderlyingSpan = memoryManagerSpan.Length;
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (67)
327span.Length); 334span.Length); 341span.Length); 348span.Length); 352return SpanHelpers.Contains(ref MemoryMarshal.GetReference(span), value, span.Length); 627span.Length); 633span.Length); 639span.Length); 645span.Length); 648return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length); 664span.Length, 671span.Length, 676return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 694span.Length); 701span.Length); 708span.Length); 715span.Length); 719return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), value, span.Length); 736span.Length, 744span.Length, 750return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length); 1651int length = span.Length; 1678span.Length, 1685span.Length, 1689return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length); 1849span.Length); 1857span.Length); 1861return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 1883span.Length); 1892span.Length); 1896return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 2155span.Length); 2163span.Length); 2167return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length); 2189span.Length); 2198span.Length); 2202return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length); 2542return valueLength <= span.Length && 2549return valueLength <= span.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), valueLength); 2579int spanLength = span.Length; 2627if (span.Length > 1) 2629SpanHelpers.Reverse(ref MemoryMarshal.GetReference(span), (nuint)span.Length); 3091/// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>. 3115/// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>. 3141/// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>. 3265if (span.Length > 1) 3283if (span.Length > 1) 3330if (keys.Length != items.Length) 3333if (keys.Length > 1) 3356if (keys.Length != items.Length) 3359if (keys.Length > 1) 3375nuint length = (uint)span.Length; 3449if (length > (uint)destination.Length) 3460(nuint)byteOffset > (nuint)(-((nint)destination.Length * sizeof(T))))) 3747if (separators.IsEmpty && destination.Length > source.Length) 3788if (separators.IsEmpty && destination.Length > source.Length) 3835if (destination.Length == 1) 3879Span<Range> destinationMinusOne = destination.Slice(0, destination.Length - 1); 3880while (separatorIndex < separatorList.Length && (rangeCount < destinationMinusOne.Length || !keepEmptyEntries)) 3903if ((uint)rangeCount >= (uint)destinationMinusOne.Length) 3922if ((uint)rangeCount < (uint)destination.Length) 4278_success = shouldAppend = destination.Length >= literalLength; 4294_success = shouldAppend = destination.Length >= literalLength; 4503if (alignment <= _destination.Length - _pos) 4623if (paddingNeeded <= _destination.Length - _pos)
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Globalization.cs (4)
205if (destination.Length < source.Length) 229if (destination.Length < source.Length) 257if (destination.Length < source.Length) 281if (destination.Length < source.Length)
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Trim.cs (3)
790if (span.Length == 0 || 801for (; start < span.Length; start++) 809int end = span.Length - 1;
src\libraries\System.Private.CoreLib\src\System\Number.Dragon4.cs (3)
119Debug.Assert(buffer.Length > 0); 299int cutoffExponent = digitExponent - buffer.Length; 537Debug.Assert(outputLen <= buffer.Length);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (14)
1650if (bufferLength > destination.Length) 1698if (bufferLength > destination.Length) 1754if (bufferLength > destination.Length) 1968if (bufferLength <= destination.Length) 1989if (bufferLength <= destination.Length) 2083if (bufferLength > destination.Length) 2131if (bufferLength > destination.Length) 2203if (bufferLength > destination.Length) 2396if (bufferLength <= destination.Length) 2416if (bufferLength <= destination.Length) 2513if (bufferLength > destination.Length) 2565if (bufferLength > destination.Length) 2628if (bufferLength > destination.Length) 2757if (bufferLength <= destination.Length)
src\libraries\System.Private.CoreLib\src\System\Numerics\INumberBase.cs (1)
476int destinationMaxCharCount = Encoding.UTF8.GetMaxCharCount(utf8Destination.Length);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.cs (2)
607if (destination.Length < Count) 621if (destination.Length < Count)
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.cs (2)
614if (destination.Length < Count) 628if (destination.Length < Count)
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector4.cs (2)
711if (destination.Length < Count) 725if (destination.Length < Count)
src\libraries\System.Private.CoreLib\src\System\Random.cs (7)
211if (destination.Length < randomBytes.Length) 213randomBytes = randomBytes.Slice(0, destination.Length); 219for (int i = 0; i < randomBytes.Length; i++) 224destination = destination.Slice(randomBytes.Length); 232for (int i = 0; i < destination.Length; i++) 313int n = values.Length;
src\libraries\System.Private.CoreLib\src\System\Random.Net5CompatImpl.cs (2)
229for (int i = 0; i < buffer.Length; i++) 317for (int i = 0; i < buffer.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Random.Xoshiro256StarStarImpl.cs (3)
140while (buffer.Length >= sizeof(ulong)) 162Debug.Assert(buffer.Length < sizeof(ulong)); 163for (int i = 0; i < buffer.Length; i++)
src\libraries\System.Private.CoreLib\src\System\ReadOnlyMemory.cs (1)
243lengthOfUnderlyingSpan = memoryManagerSpan.Length;
src\libraries\System.Private.CoreLib\src\System\ReadOnlySpan.cs (2)
302if ((uint)_length <= (uint)destination.Length) 323if ((uint)_length <= (uint)destination.Length)
src\libraries\System.Private.CoreLib\src\System\Reflection\AssemblyNameHelpers.StrongName.cs (1)
31publicKeyToken[i] = hash[hash.Length - 1 - i];
src\libraries\System.Private.CoreLib\src\System\Reflection\ConstructorInvoker.cs (2)
204int argLen = arguments.Length; 397for (int i = 0; i < dest.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodInvoker.cs (2)
241int argLen = arguments.Length; 450for (int i = 0; i < dest.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (1)
609for (int i = 0; i < bits.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DefaultInterpolatedStringHandler.cs (4)
574if (_chars.Length - _pos < additionalChars) 608Debug.Assert(additionalChars > _chars.Length - _pos); 619GrowCore((uint)_chars.Length + 1); 631uint newCapacity = Math.Max(requiredMinCapacity, Math.Min((uint)_chars.Length * 2, string.MaxLength));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\AnsiStringMarshaller.cs (2)
79if ((long)Marshal.SystemMaxDBCSCharSize * managed.Length >= buffer.Length) 83if (exactByteCount > buffer.Length)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ArrayMarshaller.cs (1)
141if (array.Length <= buffer.Length)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\BStrStringMarshaller.cs (1)
80if (manualBstrNeeds > buffer.Length)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\PointerArrayMarshaller.cs (1)
142if (array.Length <= buffer.Length)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ReadOnlySpanMarshaller.cs (1)
113if (managed.Length <= buffer.Length)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SpanMarshaller.cs (6)
44numElements = managed.Length; 141if (managed.Length <= buffer.Length) 143_span = buffer[0..managed.Length]; 147int bufferSize = checked(managed.Length * sizeof(TUnmanagedElement)); 149_span = new Span<TUnmanagedElement>(_allocatedMemory, managed.Length);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\Utf8StringMarshaller.cs (2)
83if ((long)MaxUtf8BytesPerChar * managed.Length >= buffer.Length) 87if (exactByteCount > buffer.Length)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\MemoryMarshal.cs (6)
40checked(span.Length * sizeof(T))); 95internal static unsafe ref T GetNonNullPinnableReference<T>(Span<T> span) => ref (span.Length != 0) ? ref Unsafe.AsRef(in span._reference) : ref Unsafe.AsRef<T>((void*)1); 129uint fromLength = (uint)span.Length; 516if ((uint)sizeof(T) > (uint)destination.Length) 535if (sizeof(T) > (uint)destination.Length) 558if (sizeof(T) > (uint)span.Length)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (4)
1055if (destination.Length >= sizeof(NativeExponentType)) 1079if (destination.Length >= sizeof(NativeExponentType)) 1103if (destination.Length >= sizeof(NativeSignificandType)) 1127if (destination.Length >= sizeof(NativeSignificandType))
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\SafeBuffer.cs (2)
242SpaceCheck(ptr, checked((nuint)(alignedSizeofT * buffer.Length))); 250for (int i = 0; i < buffer.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\ISimdVector_2.cs (2)
154if (destination.Length < TSelf.Count) 527if (destination.Length < TSelf.Count)
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (2)
705if (destination.Length < Vector128<T>.Count) 2833if (destination.Length < Vector128<T>.Count)
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256.cs (2)
613if (destination.Length < Vector256<T>.Count) 2764if (destination.Length < Vector256<T>.Count)
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512.cs (2)
539if ((uint)destination.Length < (uint)Vector512<T>.Count) 2777if ((uint)destination.Length < (uint)Vector512<T>.Count)
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64.cs (2)
583if (destination.Length < Vector64<T>.Count) 2635if (destination.Length < Vector64<T>.Count)
src\libraries\System.Private.CoreLib\src\System\Runtime\Versioning\FrameworkName.cs (1)
140for (int i = 1; i < components.Length; i++)
src\libraries\System.Private.CoreLib\src\System\SByte.cs (2)
429if (destination.Length >= sizeof(sbyte)) 447if (destination.Length >= sizeof(sbyte))
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\RabinKarp.cs (1)
175Debug.Assert(charsWritten == upperCase.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\TeddyBucketizer.cs (1)
129for (int i = 0; i < bucketIndexes.Length; i++)
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\StringSearchValues.cs (2)
64Debug.Assert(i == normalizedValues.Length); 109Debug.Assert(newCount <= values.Length - unreachableValues.Count);
src\libraries\System.Private.CoreLib\src\System\Security\SecureString.cs (2)
361byteLength = (span.Length + 1) * sizeof(char); 381resultSpan[resultSpan.Length - 1] = '\0';
src\libraries\System.Private.CoreLib\src\System\Single.cs (4)
723if (destination.Length >= sizeof(sbyte)) 741if (destination.Length >= sizeof(sbyte)) 759if (destination.Length >= sizeof(uint)) 783if (destination.Length >= sizeof(uint))
src\libraries\System.Private.CoreLib\src\System\Span.cs (3)
249if (index < _span.Length) 320if ((uint)_length <= (uint)destination.Length) 341if ((uint)_length <= (uint)destination.Length)
src\libraries\System.Private.CoreLib\src\System\String.cs (2)
434if ((uint)Length <= (uint)destination.Length) 451if ((uint)Length <= (uint)destination.Length)
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (1)
1442Debug.Assert(this.Length - thisIdx == dstSpan.Length - dstIdx);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.CaseConversion.cs (5)
170if (source.Length <= destination.Length) 177numElementsToConvert = (uint)destination.Length; 198nuint numElementsActuallyConverted = ChangeCase<T, T, TCasing>(pBuffer, pBuffer, (nuint)buffer.Length); 199Debug.Assert(numElementsActuallyConverted <= (nuint)buffer.Length); 202return elementsWritten == buffer.Length ? OperationStatus.Done : OperationStatus.InvalidData;
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Transcoding.cs (4)
25if (source.Length <= destination.Length) 32numElementsToConvert = (uint)destination.Length; 60if (source.Length <= destination.Length) 67numElementsToConvert = (uint)destination.Length;
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (8)
321return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length); 331int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false); 393int numElementsToConvert = Math.Min(chars.Length, bytes.Length); 423return originalBytesLength - bytes.Length; // total number of bytes written 612return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length); 622int written = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length, throwForDestinationOverflow: false); 681int numElementsToConvert = Math.Min(bytes.Length, chars.Length); 711return originalCharsLength - chars.Length; // total number of chars written
src\libraries\System.Private.CoreLib\src\System\Text\Decoder.cs (2)
201return GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length, flush); 307Convert(bytesPtr, bytes.Length, charsPtr, chars.Length, flush, out bytesUsed, out charsUsed, out completed);
src\libraries\System.Private.CoreLib\src\System\Text\DecoderFallback.cs (2)
269int originalCharCount = chars.Length; 287charsWritten = originalCharCount - chars.Length;
src\libraries\System.Private.CoreLib\src\System\Text\DecoderNLS.cs (3)
351Debug.Assert(combinedBufferBytesConsumed == combinedBuffer.Length, "We should be asked to persist the entire combined buffer."); 382if ((uint)total >= (uint)dest.Length) 394if ((uint)total >= (uint)dest.Length)
src\libraries\System.Private.CoreLib\src\System\Text\Encoder.cs (2)
198return GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length, flush); 306Convert(charsPtr, chars.Length, bytesPtr, bytes.Length, flush, out charsUsed, out bytesUsed, out completed);
src\libraries\System.Private.CoreLib\src\System\Text\EncoderFallback.cs (3)
195int originalBytesLength = bytes.Length; 218bytesWritten = originalBytesLength - bytes.Length; 239bytesWritten = originalBytesLength - bytes.Length;
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.cs (4)
732return GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length); 744if (required <= bytes.Length) 881return GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length); 893if (required <= chars.Length)
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.Internal.cs (11)
541ThrowBytesOverflow(encoder, nothingEncoded: bytes.Length == originalByteCount); // might not throw if we wrote at least one byte 552bytesLength: bytes.Length, 572return originalByteCount - bytes.Length; // total number of bytes written up until now 655bytesLength: bytes.Length, 684ThrowBytesOverflow(encoder, nothingEncoded: bytes.Length == originalBytesLength); 703return originalBytesLength - bytes.Length; 1155charsLength: chars.Length, 1168return originalCharCount - chars.Length; // total number of chars written 1255charsLength: chars.Length, 1281ThrowCharsOverflow(decoder, nothingDecoded: chars.Length == originalCharsLength); 1298return originalCharsLength - chars.Length; // total number of chars written
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (5)
233return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length); 243int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false); 528return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length); 535if (bytes.Length <= chars.Length) 540charsWritten = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Rune.cs (4)
1026else if (destination.Length > 1) 1073if (destination.Length > 1) 1084if (destination.Length > 2) 1096if (destination.Length > 3)
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (3)
1722if ((uint)charsWritten > (uint)RemainingCurrentChunk.Length) 2898if ((uint)charsWritten > (uint)destination.Length) 2962if ((uint)charsWritten > (uint)destination.Length)
src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (1)
353int bytesToReturn = Math.Min(_readBufferCount, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (11)
68outputBytesRemaining: destination.Length, 97if (destination.Length <= 2) 159outputCharsRemaining: destination.Length, 253outputCharsRemaining: destination.Length, 290if (destination.Length < bytesConsumedJustNow) 375_success = shouldAppend = destination.Length >= literalLength; // UTF8 encoding never produces fewer bytes than input characters 391_success = shouldAppend = destination.Length >= literalLength; // UTF8 encoding never produces fewer bytes than input characters 409ref MemoryMarshal.GetReference(dest), dest.Length); 680GrowAndAppendFormatted(ref this, value, utf16.Length, out charsWritten, format); 727GrowAndAppendFormatted(ref this, value, utf16.Length, out charsWritten, format); 784if (paddingNeeded <= _destination.Length - _pos)
src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (5)
368return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length); 378int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false); 563return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length); 573int written = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length, throwForDestinationOverflow: false); 661return originalCharsLength - chars.Length; // total number of chars written
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
3494for (int i = 0; i < continuations.Length; i++) 3548for (int i = 0; i < continuations.Length; i++)
src\libraries\System.Private.CoreLib\src\System\TimeOnly.cs (2)
930Debug.Assert(charsWritten == destination.Length); 937Debug.Assert(charsWritten == destination.Length);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.FullGlobalizationData.Unix.cs (2)
118return Interop.Globalization.GetTimeZoneDisplayName(locale, id, type, bufferPtr, buffer.Length); 138return Interop.Globalization.GetTimeZoneDisplayName(locale, id, type, bufferPtr, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (2)
400if (destination.Length >= sizeof(ushort)) 418if (destination.Length >= sizeof(ushort))
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (2)
432if (destination.Length >= sizeof(uint)) 450if (destination.Length >= sizeof(uint))
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (2)
431if (destination.Length >= sizeof(ulong)) 449if (destination.Length >= sizeof(ulong))
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (2)
441if (destination.Length >= sizeof(nuint_t)) 464if (destination.Length >= sizeof(nuint_t))
src\System\RuntimeHandles.cs (1)
170Span<IntPtr> outHandles = inHandles.Length <= stackScratch.Length ?
src\System\RuntimeType.CoreCLR.cs (1)
1301(!declaringType.IsInterface && !isInterface && usedSlots.Length >= numVirtuals));
src\System\Threading\WaitHandle.CoreCLR.cs (1)
18return WaitMultipleIgnoringSyncContext(pWaitHandles, waitHandles.Length, waitAll, millisecondsTimeout);
System.Private.CoreLib.Generators (14)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (14)
29Debug.Assert(value <= _span.Length); 50if ((uint)pos < (uint)span.Length) 66if (source.Length == 1 && (uint)pos < (uint)span.Length) 80if ((uint)(_pos + source.Length) > (uint)_span.Length) 82Grow(_span.Length - _pos + source.Length); 93if ((uint)(_pos + source.Length) > (uint)_span.Length) 110if ((ulong)(uint)pos + (ulong)(uint)length <= (ulong)(uint)span.Length) // same guard condition as in Span<T>.Slice on 64-bit 125Grow(_span.Length - pos + length); 134Debug.Assert(_pos == _span.Length); 180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
System.Private.DataContractSerialization (12)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
System\Runtime\Serialization\Json\JsonEncodingStreamWrapper.cs (1)
206int count = buffer.Length;
System\Runtime\Serialization\MemoryStreamAdapter.cs (1)
64if (slicedBuffer.Length < buffer.Length)
System\Xml\EncodingStreamWrapper.cs (1)
616int count = buffer.Length;
System\Xml\XmlBufferReader.cs (4)
493if (dst.Length > 0) 495GetBuffer(dst.Length, out _offset) 496.AsSpan(_offset, dst.Length) 499Advance(dst.Length);
System\Xml\XmlConverter.cs (2)
1101return chars.Length; 1142Debug.Assert(count == chars.Length);
System.Private.Uri (36)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Net\IPv4AddressHelper.Common.cs (1)
23for (int i = 0; i < numbers.Length; ++i)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Uri.cs (9)
4561for (int i = span.Length - 1; i >= 0; i--) 4598|| (lastSlash == 0 && i + dotCount + 1 == span.Length)) // "/..." 4606span = span.Slice(0, span.Length - (lastSlash - i - 1)); 4634span = span.Slice(0, span.Length - (lastSlash - i)); 4640if (span.Length != 0 && syntax.InFact(UriSyntaxFlags.CanonicalizeAsFilePath)) 4649return span.Length - lastSlash; 4655if (lastSlash == dotCount || (lastSlash == 0 && dotCount == span.Length)) 4659return span.Length - dotCount; 4665return span.Length;
System\UriExt.cs (1)
650if (destination.Length >= newLength)
System\UriHelper.cs (4)
19Debug.Assert(charsWritten == buffer.Length); 123if (destination.Length < charsToEscape.Length) 159if (destination.Length >= newLength) 633Debug.Assert(buffer.Length == destIndex);
System\ValueStringBuilderExtensions.cs (2)
15if ((uint)(pos + 1) < (uint)chars.Length && (uint)pos < (uint)chars.Length)
System.Private.Xml (26)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Xml\Base64Decoder.cs (2)
125if ((uint)iByte >= (uint)bytes.Length) 159if (iByte == bytes.Length)
System\Xml\BinaryXml\XmlBinaryReader.cs (1)
2333int cch = dstChars.Length;
System\Xml\BinHexDecoder.cs (1)
146if ((uint)iByte >= (uint)bytes.Length)
System\Xml\Schema\XsdDateTime.cs (1)
550return destination.Length >= vsb.Length;
System\Xml\Schema\XsdDuration.cs (1)
444return destination.Length >= vsb.Length;
System\Xml\XmlConvert.cs (1)
1650if (destination.Length < 1) return false;
System.Reflection.Metadata (24)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (2)
256if (parts.Length is < 2 or > 4) 262for (int i = 0; i < parts.Length; i++)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Reflection\Internal\Utilities\ImmutableMemoryStream.cs (1)
80int result = Math.Min(buffer.Length, _array.Length - _position);
System\Reflection\Internal\Utilities\ReadOnlyUnmanagedMemoryStream.cs (1)
44int bytesRead = Math.Min(buffer.Length, _length - _position);
System\Reflection\Internal\Utilities\StreamExtensions.cs (1)
82=> stream.ReadAtLeast(buffer, buffer.Length, throwOnEndOfStream: false);
System.Runtime.Numerics (207)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Number.Formatting.Common.cs (2)
502if (thousandsSepCtr >= thousandsSepPos.Length) 504var newThousandsSepPos = new int[thousandsSepPos.Length * 2];
src\libraries\Common\src\System\Number.NumberBuffer.cs (4)
54DigitsLength = digits.Length; 71for (numDigits = 0; numDigits < Digits.Length; numDigits++) 84Debug.Assert(numDigits < Digits.Length, "Null terminator not found in Number"); 99for (int i = 0; i < Digits.Length; i++)
src\libraries\Common\src\System\Number.Parsing.Common.cs (1)
95int maxDigCount = number.Digits.Length - 1;
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (14)
29Debug.Assert(value <= _span.Length); 50if ((uint)pos < (uint)span.Length) 66if (source.Length == 1 && (uint)pos < (uint)span.Length) 80if ((uint)(_pos + source.Length) > (uint)_span.Length) 82Grow(_span.Length - _pos + source.Length); 93if ((uint)(_pos + source.Length) > (uint)_span.Length) 110if ((ulong)(uint)pos + (ulong)(uint)length <= (ulong)(uint)span.Length) // same guard condition as in Span<T>.Slice on 64-bit 125Grow(_span.Length - pos + length); 134Debug.Assert(_pos == _span.Length); 180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
System\Number.BigInteger.cs (13)
512Debug.Assert(blockSize == multiplier.Length); 513Debug.Assert(multiplier.Length == lowerLen); 568Debug.Assert(buffer.Length == currentBufferSize || buffer[currentBufferSize] == 0); 629for (int i = 0; i < curBits.Length; i++) 641if (currentBufferSize == currentBuffer.Length) 678int cur = bits.Length - 1; 762long tmpCharCount = charsInHighByte + ((long)(bytes.Length - 1) << 3); 782if (charsIncludeDigits > destination.Length) 808for (int i = bytes.Length - 2; i >= 0; i--) 945if (destination.Length < strLength) 973BigIntegerToDecChars((Utf16Char*)ptr + span.Length, new ReadOnlySpan<uint>((void*)state.ptr, state.Length), state.digits); 1078Debug.Assert(destination.Length * TParser.DigitsPerBlock == input.Length); 1081for (int i = 0; i < destination.Length; i++)
System\Numerics\BigInteger.cs (49)
221Debug.Assert(bits.Length == 4 && (bits[3] & DecimalScaleFactorMask) == 0); 530if (value.Length > MaxLength) 535int dwordCount = value.Length; 584int len = value.Length; 1333if (destination.Length != 0) 1430if (destination.Length < length) 1507Debug.Assert(_bits is null || _sign == 0 ? buffer.Length == 2 : buffer.Length >= _bits.Length + 1); 1522NumericsHelpers.DangerousMakeTwosComplement(buffer.Slice(0, buffer.Length - 1)); // Mutates dwords 1530int msb = buffer.Length - 2; 1544buffer[buffer.Length - 1] = highDWord; 2351size = Math.Max(x.Length, y.Length); 2356for (int i = 0; i < z.Length; i++) 2358uint xu = ((uint)i < (uint)x.Length) ? x[i] : xExtend; 2359uint yu = ((uint)i < (uint)y.Length) ? y[i] : yExtend; 2407size = Math.Max(x.Length, y.Length); 2412for (int i = 0; i < z.Length; i++) 2414uint xu = ((uint)i < (uint)x.Length) ? x[i] : xExtend; 2415uint yu = ((uint)i < (uint)y.Length) ? y[i] : yExtend; 2458size = Math.Max(x.Length, y.Length); 2463for (int i = 0; i < z.Length; i++) 2465uint xu = ((uint)i < (uint)x.Length) ? x[i] : xExtend; 2466uint yu = ((uint)i < (uint)y.Length) ? y[i] : yExtend; 2514for (int i = 0; i < xd.Length; i++) 2523for (i = 0; i < xd.Length; i++) 2531zd[zd.Length - 1] = carry; 2569if (shift >= ((long)kcbitUint * xd.Length)) 2583trackSignBit = smallShift == 0 && xd[xd.Length - 1] == 0; 2595for (int i = xd.Length - 1; i >= digitShift; i--) 2604for (int i = xd.Length - 1; i >= digitShift; i--) 2607if (negx && i == xd.Length - 1) 2620zd[zd.Length - 1] = 0xFFFFFFFF; 3103Debug.Assert(_bits is null ? xd.Length == 1 : xd.Length == _bits.Length); 3276int srcIndex = xd.Length - digitShift; 3286while (srcIndex < xd.Length); 3290while (dstIndex < zd.Length) 3314srcIndex = xd.Length - digitShift; 3328while (srcIndex < xd.Length); 3332while (dstIndex < zd.Length) 3421while (srcIndex < xd.Length); 3425while (dstIndex < zd.Length) 3462while (srcIndex < xd.Length); 3466while (dstIndex < zd.Length) 3599if (destination.Length >= byteCount) 3701if (destination.Length >= byteCount)
System\Numerics\BigIntegerCalculator.AddSub.cs (8)
22Debug.Assert(bits.Length == left.Length + 1); 31Debug.Assert(bits.Length == left.Length + 1); 61Debug.Assert(left.Length >= right.Length); 80for ( ; carry != 0 && i < left.Length; i++) 94Debug.Assert(bits.Length == left.Length); 104Debug.Assert(bits.Length == left.Length); 134Debug.Assert(left.Length >= right.Length); 155for (; carry != 0 && i < left.Length; i++)
System\Numerics\BigIntegerCalculator.DivRem.cs (17)
14Debug.Assert(quotient.Length == left.Length); 35Debug.Assert(quotient.Length == left.Length); 69Debug.Assert(quotient.Length == left.Length - right.Length + 1); 70Debug.Assert(remainder.Length == left.Length); 81Debug.Assert(quotient.Length == left.Length - right.Length + 1); 105Debug.Assert(remainder.Length >= left.Length); 115Debug.Assert(left.Length >= 1); 117Debug.Assert(left.Length >= right.Length); 118Debug.Assert(bits.Length == left.Length - right.Length + 1 119|| bits.Length == 0); 144for (int i = left.Length; i >= right.Length; i--) 147uint t = (uint)i < (uint)left.Length ? left[i] : 0; 188if ((uint)n < (uint)bits.Length) 191if ((uint)i < (uint)left.Length) 198Debug.Assert(left.Length >= right.Length); 217Debug.Assert(left.Length >= right.Length);
System\Numerics\BigIntegerCalculator.FastReducer.cs (12)
26Debug.Assert(r.Length == modulus.Length * 2 + 1); 27Debug.Assert(mu.Length == r.Length - modulus.Length + 1); 28Debug.Assert(q1.Length == modulus.Length * 2 + 2); 29Debug.Assert(q2.Length == modulus.Length * 2 + 2); 32r[r.Length - 1] = 1; 46Debug.Assert(value.Length <= _modulus.Length * 2); 49if (value.Length < _modulus.Length) 50return value.Length; 72Debug.Assert(bits.Length + k >= left.Length + right.Length); 109if (left.Length > k) 123return left.Length;
System\Numerics\BigIntegerCalculator.GcdInv.cs (17)
62Debug.Assert(result.Length == left.Length); 80Debug.Assert(left.Length >= 2); 81Debug.Assert(right.Length >= 2); 82Debug.Assert(left.Length >= right.Length); 93while (right.Length > 2) 182if (right.Length > 0) 190if (right.Length > 1) 205Debug.Assert(buffer.Length >= 2); 207if (buffer.Length > 2) 280Debug.Assert(x.Length >= 1); 281Debug.Assert(y.Length >= 1); 282Debug.Assert(x.Length >= y.Length); 288int length = y.Length; 306Debug.Assert(bits.Length >= maxLength); 308if (bits.Length > maxLength)
System\Numerics\BigIntegerCalculator.PowMod.cs (32)
23Debug.Assert(bits.Length == PowBound(power, value.Length)); 26Span<uint> temp = (bits.Length <= StackAllocThreshold ? 28: tempFromPool = ArrayPool<uint>.Shared.Rent(bits.Length)).Slice(0, bits.Length); 32Span<uint> valueCopy = (bits.Length <= StackAllocThreshold ? 34: valueCopyFromPool = ArrayPool<uint>.Shared.Rent(bits.Length)).Slice(0, bits.Length); 40bits.Slice(result.Length).Clear(); 50Debug.Assert(value.Length >= valueLength); 51Debug.Assert(temp.Length == result.Length); 52Debug.Assert(value.Length == temp.Length); 72Debug.Assert(leftLength <= left.Length); 95Debug.Assert(valueLength <= value.Length); 96Debug.Assert(temp.Length >= valueLength + valueLength); 212Debug.Assert(bits.Length == modulus.Length + modulus.Length); 218int size = Math.Max(value.Length, bits.Length); 238Span<uint> temp = (bits.Length <= StackAllocThreshold ? 240: tempFromPool = ArrayPool<uint>.Shared.Rent(bits.Length)).Slice(0, bits.Length); 261Debug.Assert(bits.Length == modulus.Length + modulus.Length); 266int size = Math.Max(value.Length, bits.Length); 287Span<uint> temp = (bits.Length <= StackAllocThreshold ? 289: tempFromPool = ArrayPool<uint>.Shared.Rent(bits.Length)).Slice(0, bits.Length); 320bits.Slice(result.Length).Clear(); 331size = r.Length - modulus.Length + 1; 358bits.Slice(result.Length).Clear(); 380bits.Slice(result.Length).Clear(); 391size = r.Length - modulus.Length + 1; 418bits.Slice(result.Length).Clear();
System\Numerics\BigIntegerCalculator.SquMul.cs (9)
23Debug.Assert(bits.Length == value.Length + value.Length); 133Debug.Assert(bits.Length == left.Length + 1); 162Debug.Assert(bits.Length >= left.Length + right.Length); 252Debug.Assert(bits.Length >= left.Length + right.Length); 274Debug.Assert(bitsLow.Length >= bitsHigh.Length); 309MultiplyKaratsuba(leftFold, rightFold, core, (leftFold.Length + 1) >> 1); 365Debug.Assert(core.Length >= left.Length); 396for (; carry != 0 && i < core.Length; i++)
System\Numerics\BigIntegerCalculator.Utils.cs (2)
50if (bits.Length >= modulus.Length) 56return bits.Length;
System\Numerics\Complex.cs (3)
2223if (destination.Length >= 6) 2234if (destination.Length >= 4) 2242if ((uint)(2 + imaginaryChars) < (uint)destination.Length)
System\Numerics\NumericsHelpers.cs (5)
113if (d.Length > 0) 129while (Vector512.IsHardwareAccelerated && d.Length - offset >= Vector512<uint>.Count) 136while (Vector256.IsHardwareAccelerated && d.Length - offset >= Vector256<uint>.Count) 143while (Vector128.IsHardwareAccelerated && d.Length - offset >= Vector128<uint>.Count) 150for (; offset < d.Length; offset++)
System.Security.Cryptography (294)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (3)
46int resultLength = ReadLink(ref pathReference, ref MemoryMarshal.GetReference(spanBuffer), spanBuffer.Length); 54else if (resultLength < spanBuffer.Length) 74arrayBuffer = ArrayPool<byte>.Shared.Rent(spanBuffer.Length * 2);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs (2)
29return BioGets(b, pBuf, buf.Length); 38internal static int BioRead(SafeBioHandle b, Span<byte> data) => BioRead(b, data, data.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Cipher.cs (3)
154if (!EvpCipherGetGcmTag(ctx, ref MemoryMarshal.GetReference(tag), tag.Length)) 169if (!EvpCipherGetAeadTag(ctx, ref MemoryMarshal.GetReference(tag), tag.Length)) 214if (!EvpCipherGetCcmTag(ctx, ref MemoryMarshal.GetReference(tag), tag.Length))
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.cs (5)
84destination.Length); 89return EvpDigestFinalXOF(ctx, destination, (uint)destination.Length); 94return EvpDigestCurrentXOF(ctx, destination, (uint)destination.Length); 99return EvpDigestXOFOneShot(type, source, source.Length, destination, (uint)destination.Length); 104int ret = EvpDigestSqueeze(ctx, destination, (uint)destination.Length, out bool haveFeature);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Mac.cs (3)
75destination.Length, 87int ret = CryptoNative_EvpMacFinal(ctx, mac, mac.Length); 99int ret = CryptoNative_EvpMacCurrent(ctx, mac, mac.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EvpPkey.Ecdh.cs (1)
33(uint)destination.Length,
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EvpPkey.Rsa.cs (3)
72destination.Length); 107destination.Length); 142destination.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Hmac.cs (1)
36int size = destination.Length;
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Security\Cryptography\DSAOpenSsl.cs (4)
236if (destination.Length < p1363SignatureSize) 251if (destination.Length >= maxSignatureSize) 255else if (maxSignatureSize > signDestination.Length) 287if (signatureLength > destination.Length)
src\libraries\Common\src\System\Security\Cryptography\ECDiffieHellmanDerivation.cs (3)
220int len = Math.Min(p.Length, retSpan.Length); 225if (retSpan.Length == 0)
src\libraries\Common\src\System\Security\Cryptography\ECDsaOpenSsl.cs (4)
124if (destination.Length < encodedSize) 137if (destination.Length >= signatureLength) 141else if (signatureLength > signDestination.Length) 170if (signatureLength > destination.Length)
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (10)
75Debug.Assert(destination.Length >= encryptedData.Length); 185if (byteCount > buf.Length) 201Debug.Assert(written == buf.Length); 475if (byteCount > buf.Length) 491Debug.Assert(written == buf.Length); 508CryptoPool.Return(rented, buf.Length); 930byte[] rentedDestination = CryptoPool.Rent(destination.Length); 976CryptoPool.Return(rentedDestination, destination.Length); 1011if (!hasher.TryGetHashAndReset(t, out tLength) || tLength != t.Length) 1019t.Slice(0, dk.Length).CopyTo(dk);
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (20)
184if (!hash.TryGetHashAndReset(hashBuf, out int bytesWritten) || bytesWritten != hashBuf.Length) 186Debug.Fail($"Hash output wrote {bytesWritten} bytes when {hashBuf.Length} was expected"); 201if (hashBuf.Length >= destination.Length) 203hashBuf.Slice(0, destination.Length).CopyTo(destination); 208destination = destination.Slice(hashBuf.Length); 239Debug.Assert(into.Length == addend.Length); 243for (int i = into.Length - 1; i >= 0; i--) 255while (destination.Length > 0) 257if (destination.Length >= bytes.Length) 264bytes.Slice(0, destination.Length).CopyTo(destination); 274Debug.Assert(destination.Length % 2 == 0); 276while (destination.Length > 0) 278if (destination.Length >= fullCopyLen) 289Span<byte> nullTerminator = destination.Slice(0, Math.Min(2, destination.Length)); 291destination = destination.Slice(nullTerminator.Length); 295ReadOnlySpan<char> trimmed = password.Slice(0, destination.Length / 2); 299if (count != destination.Length) 301Debug.Fail($"Partial copy wrote {count} bytes of {destination.Length} expected");
src\libraries\Common\src\System\Security\Cryptography\RSAOpenSsl.cs (7)
124if (destination.Length < keySizeBytes) 130if (keySizeBytes > tmp.Length) 139if (destination.Length < written) 184if (destination.Length < rsaSize) 251if (destination.Length < rsaSize) 795Debug.Assert(destination.Length == 0); 799else if (destination.Length < bytesRequired)
src\libraries\Common\src\System\Security\Cryptography\RsaPaddingProcessor.cs (22)
125int k = destination.Length; 134Span<byte> mInEM = destination.Slice(destination.Length - source.Length); 135Span<byte> ps = destination.Slice(2, destination.Length - source.Length - 3); 138destination[ps.Length + 2] = 0; 157int spaceRemain = destination.Length - len; 161len = Choose(spaceRemainSign, destination.Length, len); 271if (destination.Length - 11 < tLen) 277int paddingLength = destination.Length - tLen - 3; 303int maxInput = checked(destination.Length - hLen - hLen - 2); 325Span<byte> mDest = db.Slice(db.Length - source.Length); 326Span<byte> ps = db.Slice(hLen, db.Length - hLen - 1 - mDest.Length); 327Span<byte> psEnd = db.Slice(hLen + ps.Length, 1); 349dbMask = CryptoPool.Rent(db.Length); 350dbMaskSpan = new Span<byte>(dbMask, 0, db.Length); 409destination.Slice(0, destination.Length - emLen).Clear(); 412Span<byte> em = destination.Slice(destination.Length - emLen, emLen); 555ReadOnlySpan<byte> salt = dbMask.Slice(dbMask.Length - sLen); 592while (writePtr.Length > 0) 598if (writePtr.Length >= hLen) 620tmp.Slice(0, writePtr.Length).CopyTo(writePtr); 633if (a.Length != b.Length)
src\libraries\Common\src\System\Security\Cryptography\SP800108HmacCounterKdf.cs (4)
286CheckPrfOutputLength(destination.Length, nameof(destination)); 366CheckPrfOutputLength(destination.Length, nameof(destination)); 445CheckPrfOutputLength(destination.Length, nameof(destination)); 496CheckPrfOutputLength(destination.Length, nameof(destination));
src\libraries\Common\src\System\Security\Cryptography\Utf8DataEncoding.cs (1)
18_buffer = (uint)maxLength <= stackBuffer.Length ?
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\Common\src\System\Text\ValueUtf8Converter.cs (1)
27if (_bytes.Length < maxSize)
System\Security\Cryptography\AesCcm.OpenSsl.cs (5)
47Interop.Crypto.EvpCipherSetCcmTagLength(ctx, tag.Length); 77if (ciphertextBytesWritten != ciphertext.Length) 79Debug.Fail($"CCM encrypt wrote {ciphertextBytesWritten} of {ciphertext.Length} bytes."); 134if (plaintextBytesWritten != plaintext.Length) 136Debug.Fail($"CCM decrypt wrote {plaintextBytesWritten} of {plaintext.Length} bytes.");
System\Security\Cryptography\AesGcm.OpenSsl.cs (4)
67if (ciphertextBytesWritten != ciphertext.Length) 69Debug.Fail($"GCM encrypt wrote {ciphertextBytesWritten} of {ciphertext.Length} bytes."); 115if (plaintextBytesWritten != plaintext.Length) 117Debug.Fail($"GCM decrypt wrote {plaintextBytesWritten} of {plaintext.Length} bytes.");
System\Security\Cryptography\AsnFormatter.cs (1)
41Debug.Assert(j == hexOrder.Length);
System\Security\Cryptography\AsymmetricAlgorithmHelpers.Der.cs (5)
68Debug.Assert(destination.Length >= encodedSize); 192if (signatureField.Length > response.Length) 194if (signatureField.Length != response.Length + 1 || 199Debug.Fail($"A signature field was longer ({signatureField.Length}) than expected ({response.Length})"); 209int writeOffset = response.Length - signatureField.Length;
System\Security\Cryptography\Base64Transforms.cs (11)
54Debug.Assert(consumed == input.Length); 55Debug.Assert(written == output.Length); 163bytesToTransform = transformBuffer.Length; 172ReturnToCryptoPool(transformBufferArray, transformBuffer.Length); 179ReturnToCryptoPool(transformBufferArray, transformBuffer.Length); 209bytesToTransform = transformBuffer.Length; 217ReturnToCryptoPool(transformBufferArray, transformBuffer.Length); 228ReturnToCryptoPool(transformBufferArray, transformBuffer.Length); 275int len = tmpBuffer.Length; 294int bytesToTransform = transformBuffer.Length; 301transformBuffer.Slice(transformBuffer.Length - _inputIndex).CopyTo(_inputBuffer);
System\Security\Cryptography\ChaCha20Poly1305.OpenSsl.cs (4)
66if (ciphertextBytesWritten != ciphertext.Length) 68Debug.Fail($"ChaCha20Poly1305 encrypt wrote {ciphertextBytesWritten} of {ciphertext.Length} bytes."); 114if (plaintextBytesWritten != plaintext.Length) 116Debug.Fail($"ChaCha20Poly1305 decrypt wrote {plaintextBytesWritten} of {plaintext.Length} bytes.");
System\Security\Cryptography\CryptographicOperations.cs (4)
190if (destination.Length < hashSizeInBytes) 267CheckDestinationSize(hashSizeInBytes, destination.Length); 505if (destination.Length < hashSizeInBytes) 617CheckDestinationSize(hashSizeInBytes, destination.Length);
System\Security\Cryptography\DSA.cs (1)
883Debug.Assert(tmp.Length == HashBufferStackSize);
System\Security\Cryptography\ECDsa.cs (4)
147if (maxSignatureSize > signature.Length) 429if (maxSignatureSize > signature.Length) 1018if (hash.Length <= destination.Length) 1203Debug.Assert(tmp.Length == HashBufferStackSize);
System\Security\Cryptography\HashAlgorithm.cs (2)
57if (destination.Length < HashSizeValue / 8) 265if (destination.Length >= hashSizeInBytes)
System\Security\Cryptography\HashProvider.cs (1)
51if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\HashProviderDispenser.Unix.cs (3)
45if (hashSize <= 0 || destination.Length < hashSize) 63if (hashSize <= 0 || destination.Length < hashSize) 70uint length = (uint)destination.Length;
System\Security\Cryptography\Helpers.cs (1)
339return ref buffer.Length != 0 ? ref MemoryMarshal.GetReference(buffer) : ref Unsafe.AsRef<byte>((void*)1);
System\Security\Cryptography\HKDF.cs (13)
52if (prk.Length < hashLength) 57if (prk.Length > hashLength) 70Debug.Assert(written == prk.Length, $"Bytes written is {written} bytes which does not match output length ({prk.Length} bytes)"); 116if (output.Length == 0) 121if (output.Length > maxOkmLength) 170if (remainingOutput.Length >= hashLength) 178if (remainingOutput.Length > 0) 183lastChunk.Slice(0, remainingOutput.Length).CopyTo(remainingOutput); 245if (output.Length == 0) 250if (output.Length > maxOkmLength) 268Debug.Assert(bytesWritten == output.Length, $"Bytes written is {bytesWritten} bytes which does not match output length ({output.Length} bytes)");
System\Security\Cryptography\HMACMD5.cs (2)
152if (destination.Length < HashSizeInBytes) 189if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\HMACSHA1.cs (2)
154if (destination.Length < HashSizeInBytes) 190if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\HMACSHA256.cs (2)
146if (destination.Length < HashSizeInBytes) 182if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\HMACSHA3_256.cs (2)
184if (destination.Length < HashSizeInBytes) 220if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\HMACSHA3_384.cs (2)
184if (destination.Length < HashSizeInBytes) 220if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\HMACSHA3_512.cs (2)
184if (destination.Length < HashSizeInBytes) 220if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\HMACSHA384.cs (2)
163if (destination.Length < HashSizeInBytes) 199if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\HMACSHA512.cs (2)
160if (destination.Length < HashSizeInBytes) 196if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\IncrementalHash.cs (8)
147/// <paramref name="destination"/> has a <see cref="Span{T}.Length"/> value less 154if (destination.Length < HashLengthInBytes) 164if (destination.Length < HashLengthInBytes) 176Debug.Assert(destination.Length >= HashLengthInBytes); 219/// <paramref name="destination"/> has a <see cref="Span{T}.Length"/> value less 226if (destination.Length < HashLengthInBytes) 254if (destination.Length < HashLengthInBytes) 266Debug.Assert(destination.Length >= HashLengthInBytes);
System\Security\Cryptography\Kmac128.cs (2)
125Debug.Assert(written == destination.Length); 165Debug.Assert(written == destination.Length);
System\Security\Cryptography\Kmac256.cs (2)
125Debug.Assert(written == destination.Length); 165Debug.Assert(written == destination.Length);
System\Security\Cryptography\KmacXof128.cs (2)
125Debug.Assert(written == destination.Length); 165Debug.Assert(written == destination.Length);
System\Security\Cryptography\KmacXof256.cs (2)
125Debug.Assert(written == destination.Length); 165Debug.Assert(written == destination.Length);
System\Security\Cryptography\LiteHash.OpenSsl.cs (2)
58return destination.Length; 64return destination.Length;
System\Security\Cryptography\LiteHash.Unix.cs (8)
71return destination.Length; 145Debug.Assert(destination.Length >= _hashSizeInBytes); 147uint length = (uint)destination.Length; 161uint length = (uint)destination.Length; 218Debug.Assert(destination.Length >= _hashSizeInBytes); 220int length = destination.Length; 228Debug.Assert(destination.Length >= _hashSizeInBytes); 230int length = destination.Length;
System\Security\Cryptography\LiteHashProvider.Xof.cs (2)
17Debug.Assert(written == destination.Length); 39Debug.Assert(written == destination.Length);
System\Security\Cryptography\MD5.cs (2)
110if (destination.Length < HashSizeInBytes) 146if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\OpenSslCipher.cs (1)
45Debug.Assert(input.Length <= output.Length);
System\Security\Cryptography\PemEncoding.cs (3)
171Debug.Assert(destination.Length >= size); 384if (destination.Length < encodedSize) 539if (charsWritten != destination.Length)
System\Security\Cryptography\RandomNumberGenerator.cs (18)
59byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 62GetBytes(array, 0, data.Length); 63new ReadOnlySpan<byte>(array, 0, data.Length).CopyTo(data); 67Array.Clear(array, 0, data.Length); 82byte[] array = ArrayPool<byte>.Shared.Rent(data.Length); 89new ReadOnlySpan<byte>(array, 0, data.Length).CopyTo(data); 93Array.Clear(array, 0, data.Length); 296int n = values.Length; 321int needed = (destination.Length + 1) / 2; 326if (destination.Length % 2 != 0) 338needed = destination.Length / 2; 347destination = destination.Slice(remainingRandom.Length * 2); 368if (destination.Length < randomBytes.Length) 370randomBytes = randomBytes.Slice(0, destination.Length); 376for (int i = 0; i < randomBytes.Length; i++) 381destination = destination.Slice(randomBytes.Length); 389for (int i = 0; i < destination.Length; i++)
System\Security\Cryptography\RandomNumberGeneratorImplementation.cs (6)
21if (data.Length > 0) 23fixed (byte* ptr = data) GetBytes(ptr, data.Length); 42if (data.Length > 0) 44fixed (byte* ptr = data) GetBytes(ptr, data.Length); 62while (data.Length > 0) 97data = data.Slice(data.Length - zerosFound);
System\Security\Cryptography\Rfc2898DeriveBytes.cs (1)
183int cb = destination.Length;
System\Security\Cryptography\RSA.cs (4)
106if (destination.Length >= result.Length) 121if (destination.Length >= result.Length) 330if (destination.Length >= result.Length) 345if (destination.Length >= result.Length)
System\Security\Cryptography\SHA1.cs (2)
105if (destination.Length < HashSizeInBytes) 140if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\SHA256.cs (2)
105if (destination.Length < HashSizeInBytes) 140if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\SHA3_256.cs (2)
138if (destination.Length < HashSizeInBytes) 176if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\SHA3_384.cs (2)
139if (destination.Length < HashSizeInBytes) 177if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\SHA3_512.cs (2)
138if (destination.Length < HashSizeInBytes) 176if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\SHA384.cs (2)
104if (destination.Length < HashSizeInBytes) 139if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\SHA512.cs (2)
104if (destination.Length < HashSizeInBytes) 139if (destination.Length < HashSizeInBytes)
System\Security\Cryptography\SP800108HmacCounterKdfImplementationManaged.cs (7)
28if (destination.Length == 0) 33Debug.Assert(destination.Length <= 0x1FFFFFFF); 49BinaryPrimitives.WriteUInt32BigEndian(lBuffer, (uint)destination.Length * 8U); 60if (destination.Length >= hash.HashLengthInBytes) 68Debug.Assert(hmacBufferWritten > destination.Length); 69hmacBuffer.Slice(0, destination.Length).CopyTo(destination); 87if (destination.Length == 0)
System\Security\Cryptography\SymmetricAlgorithm.cs (1)
727|| (uint)written > decryptBuffer.Length)
System\Security\Cryptography\SymmetricPadding.cs (5)
48if (destination.Length < count) 63if (destination.Length < ansiSize) 80if (destination.Length < isoSize) 97if (destination.Length < pkcsSize) 118if (destination.Length < zeroSize)
System\Security\Cryptography\UniversalCryptoDecryptor.cs (1)
114if (decryptedBytes.Length > 0)
System\Security\Cryptography\UniversalCryptoOneShot.cs (6)
29if (output.Length >= input.Length) 61input.Length - cipher.BlockSizeInBytes > output.Length) 85if (output.Length < depaddedLength) 136if (output.Length - writtenToOutput < depaddedLength) 177if (unpaddedLength > output.Length) 204if (output.Length < ciphertextLength)
System\Security\Cryptography\X509Certificates\OpenSslCrlCache.cs (1)
284if (SHA256.HashData(utf16Url, hash) != hash.Length)
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (1)
285if (chainSize <= tempChain.Length)
System\Security\Cryptography\X509Certificates\UnixExportProvider.cs (1)
340Debug.Assert(certContentsIv.Length * 8 == cipher.BlockSize);
System\Security\Cryptography\X509Certificates\X500NameEncoder.cs (1)
547Debug.Assert(destination.Length >= chars.Length);
System\Security\Cryptography\X509Certificates\X509Certificate2Collection.cs (2)
496charsWritten != destination.Length) 544if (buffer.Length < certSize)
System.Security.Cryptography.Cose (4)
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (2)
358if (expectedSize > destination.Length) 586if (destination.Length < GetEncodedLength())
System\Security\Cryptography\Cose\CoseSign1Message.cs (2)
296if (expectedSize > destination.Length) 809if (destination.Length < GetEncodedLength())
System.Text.Encoding.CodePages (1)
System\Text\BaseCodePageEncoding.netcoreapp.cs (1)
18Debug.Assert(bytesRead == codePageIndex.Length);
System.Text.Encodings.Web (47)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Text\Encodings\Web\AllowedBmpCodePointsBitmap.cs (2)
70Debug.Assert(definedCharsBitmapAsLittleEndian.Length == thisAllowedCharactersBitmap.Length * sizeof(uint)); 87for (int i = 0; i < thisAllowedCharactersBitmap.Length; i++)
System\Text\Encodings\Web\DefaultHtmlEncoder.cs (4)
118for (int i = destination.Length - 1; SpanUtility.IsValidIndex(destination, i); i--) 125return destination.Length + 4; 195for (int i = destination.Length - 1; SpanUtility.IsValidIndex(destination, i); i--) 202return destination.Length + 4;
System\Text\Encodings\Web\SpanUtility.cs (8)
24return ((uint)index < (uint)span.Length) ? true : false; 37if (span.Length >= 4) 67if (span.Length >= 5) 99if (span.Length >= 6) 134if (span.Length >= 4) 164if (span.Length >= 5) 196if (span.Length >= 6) 228if (AreValidIndexAndLength(span.Length, offset, sizeof(ulong)))
System\Text\Encodings\Web\TextEncoder.cs (14)
46return TryEncodeUnicodeScalar((int)unicodeScalar, pBuffer, buffer.Length, out charsWritten); 168if (charsWrittenJustNow == 0 || (uint)charsWrittenJustNow > (uint)destBuffer.Length) 175stringBuilder.Length -= destBuffer.Length - charsWrittenJustNow; 293if (utf8Destination.Length < utf8Source.Length) 295sourceSearchSpace = utf8Source.Slice(0, utf8Destination.Length); 330int originalUtf8DestinationLength = utf8Destination.Length; 355if ((uint)dstIdxTemp >= (uint)utf8Destination.Length) 383bytesWritten = originalUtf8DestinationLength - utf8Destination.Length; 423if (destination.Length < source.Length) 425sourceSearchSpace = source.Slice(0, destination.Length); 455int originalDestinationLength = destination.Length; 499charsWritten = originalDestinationLength - destination.Length; 527if (charsWrittenJustNow == 0 || (uint)charsWrittenJustNow > (uint)scratchBuffer.Length) 580if (destination.Length < source.Length)
System.Text.Json (44)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\System.Text.Json\Common\JsonCamelCaseNamingPolicy.cs (2)
30for (int i = 0; i < chars.Length; i++) 37bool hasNext = (i + 1 < chars.Length);
src\libraries\System.Text.Json\Common\JsonHelpers.cs (4)
64Span<(TKey, int)> keys = span.Length <= StackallocThreshold 65? (stackalloc (TKey, int)[StackallocThreshold]).Slice(0, span.Length) 66: new (TKey, int)[span.Length]; 68for (int i = 0; i < keys.Length; i++)
src\libraries\System.Text.Json\Common\JsonSeparatorNamingPolicy.cs (2)
149if (charsWritten == destination.Length) 159int newSize = checked(destination.Length * 2);
System\Text\Json\Document\JsonDocument.TryGetProperty.cs (1)
187Span<byte> utf8Unescaped = remaining <= utf8UnescapedStack.Length ?
System\Text\Json\JsonEncodedText.cs (1)
94Debug.Assert(expectedByteCount == utf8Bytes.Length);
System\Text\Json\Reader\JsonReaderHelper.cs (3)
93if (JsonHelpers.IsValidUnescapedDateTimeOffsetParseLength(sourceUnescaped.Length) 115if (JsonHelpers.IsValidUnescapedDateTimeOffsetParseLength(sourceUnescaped.Length) 137if (utf8Unescaped.Length == JsonConstants.MaximumFormatGuidLength
System\Text\Json\Reader\JsonReaderHelper.Unescaping.cs (4)
402Debug.Assert(destination.Length >= source.Length); 415Debug.Assert(destination.Length >= source.Length); 452if (written == destination.Length) 561if ((uint)(written + nextUnescapedSegmentLength) >= (uint)destination.Length)
System\Text\Json\Reader\Utf8JsonReader.MultiSegment.cs (1)
592int amountToWrite = Math.Min(span.Length, readSoFar.Length - written);
System\Text\Json\Writer\JsonWriterHelper.cs (1)
15Debug.Assert(buffer.Length >= indent);
System\Text\Json\Writer\JsonWriterHelper.Date.cs (6)
51Debug.Assert(buffer.Length == maxDateTimeLength || 52buffer.Length == maxDateTimeLength + 1 || 53buffer.Length == JsonConstants.MaximumFormatDateTimeOffsetLength); 77bytesWritten = buffer.Length; 83if (buffer.Length == maxDateTimeLength) 88else if (buffer.Length == JsonConstants.MaximumFormatDateTimeOffsetLength)
System.Text.Json.SourceGeneration (18)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (14)
29Debug.Assert(value <= _span.Length); 50if ((uint)pos < (uint)span.Length) 66if (source.Length == 1 && (uint)pos < (uint)span.Length) 80if ((uint)(_pos + source.Length) > (uint)_span.Length) 82Grow(_span.Length - _pos + source.Length); 93if ((uint)(_pos + source.Length) > (uint)_span.Length) 110if ((ulong)(uint)pos + (ulong)(uint)length <= (ulong)(uint)span.Length) // same guard condition as in Span<T>.Slice on 64-bit 125Grow(_span.Length - pos + length); 134Debug.Assert(_pos == _span.Length); 180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\libraries\System.Text.Json\Common\JsonCamelCaseNamingPolicy.cs (2)
30for (int i = 0; i < chars.Length; i++) 37bool hasNext = (i + 1 < chars.Length);
src\libraries\System.Text.Json\Common\JsonSeparatorNamingPolicy.cs (2)
149if (charsWritten == destination.Length) 159int newSize = checked(destination.Length * 2);
System.Text.RegularExpressions (53)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (14)
29Debug.Assert(value <= _span.Length); 50if ((uint)pos < (uint)span.Length) 66if (source.Length == 1 && (uint)pos < (uint)span.Length) 80if ((uint)(_pos + source.Length) > (uint)_span.Length) 82Grow(_span.Length - _pos + source.Length); 93if ((uint)(_pos + source.Length) > (uint)_span.Length) 110if ((ulong)(uint)pos + (ulong)(uint)length <= (ulong)(uint)span.Length) // same guard condition as in Span<T>.Slice on 64-bit 125Grow(_span.Length - pos + length); 134Debug.Assert(_pos == _span.Length); 180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
System\Text\RegularExpressions\Regex.Replace.cs (2)
226for (int i = 0; i < span.Length; i++) 235for (int i = 0; i < span.Length; i++)
System\Text\RegularExpressions\RegexCharClass.cs (9)
672numCategories == categories.Length) 687numCategories == categories.Length) 712if (numCategories == categories.Length) 733if (numCategories == categories.Length) 856if (++evaluated > chars.Length) 1063Debug.Assert(twoChars.Length >= 2); 1606span[SetLengthIndex] = (char)(span.Length - SetStartIndex); 1617Debug.Assert(i == span.Length); 1972Span<char> invertedGroup = group.Length <= scratch.Length ? scratch.Slice(0, group.Length) : new char[group.Length];
System\Text\RegularExpressions\RegexReplacement.cs (3)
268int length = ((span.Length / 2) - 1) * replacement.Length; 269for (int i = 1; i < span.Length; i += 2) // the count of each pair is the second item 278for (int i = 0; i < span.Length; i += 2)
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (3)
428Debug.Assert(cat >= 0 && cat < categoryCodes.Length, $"Expected {cat} to be in range [0, {categoryCodes.Length})."); 507for (int i = 0; i < catCodes.Length; i++)
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Dgml.cs (3)
152Debug.Assert(deltas.Length == matcher._minterms.Length); 153for (int i = 0; i < deltas.Length; ++i) 167if (nfaDeltas.Length > 0 && nfaDeltas[i] is int[] nfaTargets)
System.Text.RegularExpressions.Generator (42)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (16)
39Debug.Assert(value <= _chars.Length); 44public int Capacity => _chars.Length; 52if ((uint)capacity > (uint)_chars.Length) 136if (_pos > _chars.Length - count) 156if (_pos > (_chars.Length - count)) 176if ((uint)pos < (uint)chars.Length) 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 225if (_pos > _chars.Length - count) 231for (int i = 0; i < dst.Length; i++) 241if (pos > _chars.Length - length) 247for (int i = 0; i < dst.Length; i++) 257if (pos > _chars.Length - value.Length) 270if (origPos > _chars.Length - length) 298Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, "Grow called incorrectly, no resize is needed."); 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (14)
29Debug.Assert(value <= _span.Length); 50if ((uint)pos < (uint)span.Length) 66if (source.Length == 1 && (uint)pos < (uint)span.Length) 80if ((uint)(_pos + source.Length) > (uint)_span.Length) 82Grow(_span.Length - _pos + source.Length); 93if ((uint)(_pos + source.Length) > (uint)_span.Length) 110if ((ulong)(uint)pos + (ulong)(uint)length <= (ulong)(uint)span.Length) // same guard condition as in Span<T>.Slice on 64-bit 125Grow(_span.Length - pos + length); 134Debug.Assert(_pos == _span.Length); 180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexCharClass.cs (9)
672numCategories == categories.Length) 687numCategories == categories.Length) 712if (numCategories == categories.Length) 733if (numCategories == categories.Length) 856if (++evaluated > chars.Length) 1063Debug.Assert(twoChars.Length >= 2); 1606span[SetLengthIndex] = (char)(span.Length - SetStartIndex); 1617Debug.Assert(i == span.Length); 1972Span<char> invertedGroup = group.Length <= scratch.Length ? scratch.Slice(0, group.Length) : new char[group.Length];
System.Web.HttpUtility (5)
src\libraries\Common\src\System\HexConverter.cs (3)
165Debug.Assert(chars.Length >= bytes.Length * 2); 333Debug.Assert(chars.Length / 2 == bytes.Length, "Target buffer not right-sized for provided characters"); 339while (j < bytes.Length)
System\Web\Util\Utf16StringValidator.cs (2)
38for (int i = state.idxOfFirstSurrogate; i < chars.Length; i++) 54if (i + 1 < chars.Length && char.IsLowSurrogate(chars[i + 1]))