diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-11-21 22:22:16 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-11-21 22:22:16 +0700 |
commit | 80a82486157077bf62ba51bbcd4f7891ae7b6a21 (patch) | |
tree | 05f088bacac60e84283a283c441ff957ff1b0b05 | |
parent | ASN.1 perf. opts (diff) | |
download | BouncyCastle.NET-ed25519-80a82486157077bf62ba51bbcd4f7891ae7b6a21.tar.xz |
Fix return values
-rw-r--r-- | crypto/src/asn1/ConstructedOctetStream.cs | 7 |
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(); |