diff --git a/src/SixLabors.Core/Memory/ArrayPoolMemoryAllocator.cs b/src/SixLabors.Core/Memory/ArrayPoolMemoryAllocator.cs index 0a5e47f28..113e12785 100644 --- a/src/SixLabors.Core/Memory/ArrayPoolMemoryAllocator.cs +++ b/src/SixLabors.Core/Memory/ArrayPoolMemoryAllocator.cs @@ -118,7 +118,6 @@ namespace SixLabors.Memory public override IManagedByteBuffer AllocateManagedByteBuffer(int length, AllocationOptions options = AllocationOptions.None) { Guard.MustBeGreaterThanOrEqualTo(length, 0, nameof(length)); - Guard.MustBeLessThan(length, int.MaxValue, nameof(length)); ArrayPool pool = this.GetArrayPool(length); byte[] byteArray = pool.Rent(length); diff --git a/src/SixLabors.Core/Memory/SimpleGcMemoryAllocator.cs b/src/SixLabors.Core/Memory/SimpleGcMemoryAllocator.cs index fc7fb607f..acf17ad63 100644 --- a/src/SixLabors.Core/Memory/SimpleGcMemoryAllocator.cs +++ b/src/SixLabors.Core/Memory/SimpleGcMemoryAllocator.cs @@ -16,7 +16,6 @@ namespace SixLabors.Memory public override IMemoryOwner Allocate(int length, AllocationOptions options = AllocationOptions.None) { Guard.MustBeGreaterThanOrEqualTo(length, 0, nameof(length)); - Guard.MustBeLessThan(length, int.MaxValue, nameof(length)); return new BasicArrayBuffer(new T[length]); } @@ -25,7 +24,6 @@ namespace SixLabors.Memory public override IManagedByteBuffer AllocateManagedByteBuffer(int length, AllocationOptions options = AllocationOptions.None) { Guard.MustBeGreaterThanOrEqualTo(length, 0, nameof(length)); - Guard.MustBeLessThan(length, int.MaxValue, nameof(length)); return new BasicByteBuffer(new byte[length]); } diff --git a/tests/SixLabors.Core.Tests/Memory/ArrayPoolMemoryAllocatorTests.cs b/tests/SixLabors.Core.Tests/Memory/ArrayPoolMemoryAllocatorTests.cs index 5226c9b01..e59590bae 100644 --- a/tests/SixLabors.Core.Tests/Memory/ArrayPoolMemoryAllocatorTests.cs +++ b/tests/SixLabors.Core.Tests/Memory/ArrayPoolMemoryAllocatorTests.cs @@ -249,7 +249,6 @@ namespace SixLabors.Memory.Tests [Theory] [InlineData(-1)] - [InlineData(int.MaxValue)] public void AllocateManagedByteBuffer_IncorrectAmount_ThrowsCorrect_ArgumentOutOfRangeException(int length) { var ex = Assert.Throws(() => this.MemoryAllocator.AllocateManagedByteBuffer(length)); diff --git a/tests/SixLabors.Core.Tests/Memory/SimpleGcMemoryAllocatorTests.cs b/tests/SixLabors.Core.Tests/Memory/SimpleGcMemoryAllocatorTests.cs index 96f92e682..86e71717e 100644 --- a/tests/SixLabors.Core.Tests/Memory/SimpleGcMemoryAllocatorTests.cs +++ b/tests/SixLabors.Core.Tests/Memory/SimpleGcMemoryAllocatorTests.cs @@ -21,7 +21,6 @@ namespace SixLabors.Memory.Tests [Theory] [InlineData(-1)] - [InlineData(int.MaxValue)] public void Allocate_IncorrectAmount_ThrowsCorrect_ArgumentOutOfRangeException(int length) { var ex = Assert.Throws(() => this.MemoryAllocator.Allocate( length)); @@ -30,7 +29,6 @@ namespace SixLabors.Memory.Tests [Theory] [InlineData(-1)] - [InlineData(int.MaxValue)] public void AllocateManagedByteBuffer_IncorrectAmount_ThrowsCorrect_ArgumentOutOfRangeException(int length) { var ex = Assert.Throws(() => this.MemoryAllocator.AllocateManagedByteBuffer(length));