aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-08 00:53:22 -0500
committerJack Lloyd <[email protected]>2016-12-08 00:53:22 -0500
commit41e7cade5889d238ca695806451db227b9792cd9 (patch)
tree52b30d0633505b5d8ecfda7ab9b6ee57a0d4aeac /src
parent388e4cb55f248c30a54d7ba87010eec560f6fc1f (diff)
Avoid crash in PKCS1v1.5 unpadding if input len <= 2
Don't think this can't happen outside of a fuzzer test
Diffstat (limited to 'src')
-rw-r--r--src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp b/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp
index 9bab8eb95..b14808da0 100644
--- a/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp
+++ b/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp
@@ -48,6 +48,12 @@ secure_vector<byte> EME_PKCS1v15::pad(const byte in[], size_t inlen,
secure_vector<byte> EME_PKCS1v15::unpad(byte& valid_mask,
const byte in[], size_t inlen) const
{
+ if(inlen < 2)
+ {
+ valid_mask = false;
+ return secure_vector<byte>();
+ }
+
CT::poison(in, inlen);
byte bad_input_m = 0;