summaryrefslogtreecommitdiff
path: root/fuzz
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2022-06-24 15:35:05 +0800
committerTomas Mraz <tomas@openssl.org>2022-06-28 17:10:11 +0200
commit1cb35ce06a968dc82e7cd9502ecce8e89eca9580 (patch)
treea91e0e2ae27758d73be412bebc77097f90562a6d /fuzz
parent28adea95975c3ea53fc590efda35dee13efd4767 (diff)
downloadopenssl-new-1cb35ce06a968dc82e7cd9502ecce8e89eca9580.tar.gz
fuzz/asn1.c: Add check for ASN1_item_i2d
As the potential failure of the ASN1_item_i2d, it should be better to check the return value. Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18647)
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/asn1.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fuzz/asn1.c b/fuzz/asn1.c
index 69978cd054..ee602a08a3 100644
--- a/fuzz/asn1.c
+++ b/fuzz/asn1.c
@@ -317,8 +317,9 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len)
ASN1_item_print(bio, o, 4, i, pctx);
BIO_free(bio);
}
- ASN1_item_i2d(o, &der, i);
- OPENSSL_free(der);
+ if (ASN1_item_i2d(o, &der, i) > 0) {
+ OPENSSL_free(der);
+ }
ASN1_item_free(o, i);
}
}