summaryrefslogtreecommitdiffstats
path: root/fuzz/cms.c
diff options
context:
space:
mode:
authorMike Aizatsky <aizatsky@google.com>2016-10-26 13:56:39 -0700
committerKurt Roeckx <kurt@roeckx.be>2016-11-01 19:24:55 +0100
commitba7407002d899b614d4728da9004594f947ff3da (patch)
tree0d30e69ed0a8af3be37f64533662e36ccccabc48 /fuzz/cms.c
parente4d94269a5a41594852dc60716500580f1d47cef (diff)
[fuzzers] do not fail fuzzers with empty input
Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #1788
Diffstat (limited to 'fuzz/cms.c')
-rw-r--r--fuzz/cms.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fuzz/cms.c b/fuzz/cms.c
index f97173add3..94390e7c91 100644
--- a/fuzz/cms.c
+++ b/fuzz/cms.c
@@ -22,8 +22,12 @@ int FuzzerInitialize(int *argc, char ***argv) {
int FuzzerTestOneInput(const uint8_t *buf, size_t len) {
CMS_ContentInfo *i;
- BIO *in = BIO_new(BIO_s_mem());
+ BIO *in;
+ if (!len) {
+ return 0;
+ }
+ in = BIO_new(BIO_s_mem());
OPENSSL_assert((size_t)BIO_write(in, buf, len) == len);
i = d2i_CMS_bio(in, NULL);
CMS_ContentInfo_free(i);