From 0e89e18c4f401d19c57ceb791131092a9df840a0 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 30 Jan 2023 09:29:56 +1100 Subject: [PATCH] Call dst_lib_destroy if we have called dst_lib_init This returns BIGNUMs to OpenSSL allowing libcrypto to fully clean up. (cherry picked from commit 897e0cd6f45bb83379ee9eca5830e6b58b0d597d) --- fuzz/dns_message_checksig.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fuzz/dns_message_checksig.c b/fuzz/dns_message_checksig.c index a5da831e5e..dfbd18ebf1 100644 --- a/fuzz/dns_message_checksig.c +++ b/fuzz/dns_message_checksig.c @@ -123,6 +123,8 @@ static char c3[] = "sig0key. 0 IN SOA . . 0 0 0 0 0\n\ sig0key. 0 IN NS .\n\ sig0key. 0 IN KEY 512 3 8 AwEAAa22lgHi1vAbQvu5ETdTrm2H8rwga9tvyMa6LFiSDyevLvSv0Uo5 uvfrXnxaLdtBMts6e1Ly2piSH9JRbOGMNibOK4EXWhWAn8MII4SWgQAs bFwtiz4HyPn2wScrUQdo8DocKiQJBanesr7vDO8fdA6Rg1e0yAtSeNti e8avx46/HJa6CFs3CoE0sf6oOFSxM954AgCBTXOGNBt1Nt3Bhfqt2qyA TLFii5K1jLDTZDVkoiyDXL1M7wcTwKf9METgj1eQmH3GGlRM/OJ/j8xk ZiFGbL3cipWdiH48031jiV2hlc92mKn8Ya0d9AN6c44piza/JSFydZXw sY32nxzjDbs=\n"; +static bool destroy_dst = false; + static void cleanup(void) { char pathbuf[PATH_MAX]; @@ -140,6 +142,9 @@ cleanup(void) { if (emptyring != NULL) { dns_tsigkeyring_detach(&emptyring); } + if (destroy_dst) { + dst_lib_destroy(); + } if (mctx != NULL) { isc_mem_detach(&mctx); } @@ -228,6 +233,7 @@ LLVMFuzzerInitialize(int *argc __attribute__((unused)), isc_result_totext(result)); return (1); } + destroy_dst = true; result = dns_view_create(mctx, dns_rdataclass_in, "view", &view); if (result != ISC_R_SUCCESS) {