aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-08-29 07:01:53 -0400
committerJack Lloyd <[email protected]>2017-08-29 07:01:53 -0400
commit922d3dcb678fa9ff9a54b9a920e530fe753da384 (patch)
tree3b7bbdc56376fd01a16c181895dd7c231a288d82 /src/lib
parentd3cc9179a72cebddf2057256ab8a4d421b202b21 (diff)
parent4a64e42c3985ae7d460cf52d3e38a13b6b562572 (diff)
Merge GH #1158 Add build mode for fuzzer tests
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/asn1/ber_dec.cpp8
-rw-r--r--src/lib/prov/openssl/openssl_rsa.cpp4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/asn1/ber_dec.cpp b/src/lib/asn1/ber_dec.cpp
index bf728a8e8..67a2c9d8e 100644
--- a/src/lib/asn1/ber_dec.cpp
+++ b/src/lib/asn1/ber_dec.cpp
@@ -544,7 +544,9 @@ BER_Decoder& BER_Decoder::decode(secure_vector<uint8_t>& buffer,
throw BER_Decoding_Error("Bad number of unused bits in BIT STRING");
buffer.resize(obj.value.size() - 1);
- copy_mem(buffer.data(), &obj.value[1], obj.value.size() - 1);
+
+ if(obj.value.size() > 1)
+ copy_mem(buffer.data(), &obj.value[1], obj.value.size() - 1);
}
return (*this);
}
@@ -569,7 +571,9 @@ BER_Decoder& BER_Decoder::decode(std::vector<uint8_t>& buffer,
throw BER_Decoding_Error("Bad number of unused bits in BIT STRING");
buffer.resize(obj.value.size() - 1);
- copy_mem(buffer.data(), &obj.value[1], obj.value.size() - 1);
+
+ if(obj.value.size() > 1)
+ copy_mem(buffer.data(), &obj.value[1], obj.value.size() - 1);
}
return (*this);
}
diff --git a/src/lib/prov/openssl/openssl_rsa.cpp b/src/lib/prov/openssl/openssl_rsa.cpp
index 58a09cb0d..b1c73d851 100644
--- a/src/lib/prov/openssl/openssl_rsa.cpp
+++ b/src/lib/prov/openssl/openssl_rsa.cpp
@@ -171,7 +171,9 @@ class OpenSSL_RSA_Verification_Operation : public PK_Ops::Verification_with_EMSA
throw Invalid_Argument("OpenSSL RSA verify input too large");
secure_vector<uint8_t> inbuf(mod_sz);
- copy_mem(&inbuf[mod_sz - msg_len], msg, msg_len);
+
+ if(msg_len > 0)
+ copy_mem(&inbuf[mod_sz - msg_len], msg, msg_len);
secure_vector<uint8_t> outbuf(mod_sz);