Update src/SharpCompress/IO/PooledMemoryStream.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Adam Hathcock 2026-04-19 12:18:47 +01:00 committed by GitHub
parent ad3c5dafd7
commit 891d1268fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -81,8 +81,8 @@ public sealed class PooledMemoryStream : MemoryStream
}
set
{
ThrowHelper.ThrowIfNegative(value, nameof(value));
EnsureNotClosed();
ThrowHelper.ThrowIfNegative(value, nameof(value));
ThrowHelper.ThrowIfGreaterThan(value, MaxStreamLength, nameof(value));
_position = (int)value;