summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-11-21 22:22:16 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-11-21 22:22:16 +0700
commit80a82486157077bf62ba51bbcd4f7891ae7b6a21 (patch)
tree05f088bacac60e84283a283c441ff957ff1b0b05
parentASN.1 perf. opts (diff)
downloadBouncyCastle.NET-ed25519-80a82486157077bf62ba51bbcd4f7891ae7b6a21.tar.xz
Fix return values
-rw-r--r--crypto/src/asn1/ConstructedOctetStream.cs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/src/asn1/ConstructedOctetStream.cs b/crypto/src/asn1/ConstructedOctetStream.cs
index 829a9a427..63d7d9d94 100644
--- a/crypto/src/asn1/ConstructedOctetStream.cs
+++ b/crypto/src/asn1/ConstructedOctetStream.cs
@@ -21,6 +21,9 @@ namespace Org.BouncyCastle.Asn1
 
 		public override int Read(byte[] buffer, int offset, int count)
 		{
+            if (count < 1)
+                return 0;
+
 			if (_currentStream == null)
 			{
 				if (!_first)
@@ -66,11 +69,11 @@ namespace Org.BouncyCastle.Asn1
 			if (_currentStream == null)
 			{
 				if (!_first)
-					return 0;
+					return -1;
 
                 Asn1OctetStringParser next = GetNextParser();
                 if (next == null)
-					return 0;
+					return -1;
 
 				_first = false;
 				_currentStream = next.GetOctetStream();