summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorDavid Hook <dgh@cryptoworkshop.com>2022-08-22 10:44:10 +1000
committerDavid Hook <dgh@cryptoworkshop.com>2022-08-22 10:44:10 +1000
commitda2a01eac0ee6d6a15c12e5ccfb5b425965d4cb4 (patch)
treeb391d41328ea6489517bfb0dfd02621696c0074d /crypto
parentSIKE: added warning, keysize test (diff)
downloadBouncyCastle.NET-ed25519-da2a01eac0ee6d6a15c12e5ccfb5b425965d4cb4.tar.xz
added input check
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/crypto/engines/SM2Engine.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/src/crypto/engines/SM2Engine.cs b/crypto/src/crypto/engines/SM2Engine.cs
index ab7e9cd17..1a121c192 100644
--- a/crypto/src/crypto/engines/SM2Engine.cs
+++ b/crypto/src/crypto/engines/SM2Engine.cs
@@ -62,6 +62,11 @@ namespace Org.BouncyCastle.Crypto.Engines
 
         public virtual byte[] ProcessBlock(byte[] input, int inOff, int inLen)
         {
+            if ((inOff + inLen) > input.Length || inLen == 0)
+            {
+                throw new DataLengthException("input buffer too short");
+            }
+
             if (mForEncryption)
             {
                 return Encrypt(input, inOff, inLen);