From d7fb66fd138380b9bb2dab5acd5b5d91de00a9ef Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 25 Feb 2020 19:54:27 +0100 Subject: [PATCH] If a key is not of a supported type, something went wrong --- programs/fuzz/fuzz_privkey.c | 8 +++++--- programs/fuzz/fuzz_pubkey.c | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/programs/fuzz/fuzz_privkey.c b/programs/fuzz/fuzz_privkey.c index 2a64f57d06..6c968fd54c 100644 --- a/programs/fuzz/fuzz_privkey.c +++ b/programs/fuzz/fuzz_privkey.c @@ -59,9 +59,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { } else #endif - { - ret = 0; - } + { + /* The key is valid but is not of a supported type. + * This should not happen. */ + abort( ); + } } mbedtls_pk_free( &pk ); #else diff --git a/programs/fuzz/fuzz_pubkey.c b/programs/fuzz/fuzz_pubkey.c index 95b75211c5..9e8035045e 100644 --- a/programs/fuzz/fuzz_pubkey.c +++ b/programs/fuzz/fuzz_pubkey.c @@ -60,7 +60,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { else #endif { - ret = 0; + /* The key is valid but is not of a supported type. + * This should not happen. */ + abort( ); } } mbedtls_pk_free( &pk );