diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-10-15 17:02:16 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-10-15 17:02:16 +0700 |
commit | 600b01545024ab5d76f8807592c1a4a4663738c2 (patch) | |
tree | 86aeea87f39cabc48b025521c87d5e8611a1e81f /crypto/src/asn1 | |
parent | Refactor ASN.1 parsers (diff) | |
download | BouncyCastle.NET-ed25519-600b01545024ab5d76f8807592c1a4a4663738c2.tar.xz |
Merge checks
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r-- | crypto/src/asn1/DefiniteLengthInputStream.cs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crypto/src/asn1/DefiniteLengthInputStream.cs b/crypto/src/asn1/DefiniteLengthInputStream.cs index d10ea4d12..e3b9b5737 100644 --- a/crypto/src/asn1/DefiniteLengthInputStream.cs +++ b/crypto/src/asn1/DefiniteLengthInputStream.cs @@ -16,16 +16,16 @@ namespace Org.BouncyCastle.Asn1 internal DefiniteLengthInputStream(Stream inStream, int length, int limit) : base(inStream, limit) { - if (length < 0) - throw new ArgumentException("negative lengths not allowed", "length"); + if (length <= 0) + { + if (length < 0) + throw new ArgumentException("negative lengths not allowed", "length"); - this._originalLength = length; - this._remaining = length; + SetParentEofDetect(true); + } - if (length == 0) - { - SetParentEofDetect(true); - } + this._originalLength = length; + this._remaining = length; } internal int Remaining |