X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=fuzz%2Fasn1parse.c;h=cf5ef72a13cf99cc24fb537a34f5b53895ed6786;hb=2805ee1e095;hp=edb4d023030273f199208a4645a4c832b38e0a11;hpb=ad4da7fbc0779fb1730c9862221e19583de69f4f;p=openssl.git diff --git a/fuzz/asn1parse.c b/fuzz/asn1parse.c index edb4d02303..cf5ef72a13 100644 --- a/fuzz/asn1parse.c +++ b/fuzz/asn1parse.c @@ -16,24 +16,28 @@ #include #include #include +#include #include "fuzzer.h" +static BIO *bio_out; + int FuzzerInitialize(int *argc, char ***argv) { + bio_out = BIO_new_file("/dev/null", "w"); + OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); + ERR_get_state(); + CRYPTO_free_ex_index(0, -1); return 1; } int FuzzerTestOneInput(const uint8_t *buf, size_t len) { - static BIO *bio_out; - - if (bio_out == NULL) - bio_out = BIO_new_file("/dev/null", "w"); - (void)ASN1_parse_dump(bio_out, buf, len, 0, 0); + ERR_clear_error(); return 0; } void FuzzerCleanup(void) { + BIO_free(bio_out); }