From 600b01545024ab5d76f8807592c1a4a4663738c2 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 15 Oct 2021 17:02:16 +0700 Subject: Merge checks --- crypto/src/asn1/DefiniteLengthInputStream.cs | 16 ++++++++-------- 1 file 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 -- cgit 1.4.1