summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-10-15 17:02:16 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-10-15 17:02:16 +0700
commit600b01545024ab5d76f8807592c1a4a4663738c2 (patch)
tree86aeea87f39cabc48b025521c87d5e8611a1e81f /crypto/src
parentRefactor ASN.1 parsers (diff)
downloadBouncyCastle.NET-ed25519-600b01545024ab5d76f8807592c1a4a4663738c2.tar.xz
Merge checks
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/asn1/DefiniteLengthInputStream.cs16
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