From 5bb8a18b00cefb2b15221e766f9a87c506ca2932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Sat, 5 Aug 2017 20:49:19 +0200 Subject: fuzzer: Initial check in for improved fuzzing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim Rühsen --- fuzz/gnutls_base64_decoder_fuzzer.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 fuzz/gnutls_base64_decoder_fuzzer.c (limited to 'fuzz/gnutls_base64_decoder_fuzzer.c') diff --git a/fuzz/gnutls_base64_decoder_fuzzer.c b/fuzz/gnutls_base64_decoder_fuzzer.c new file mode 100644 index 0000000000..d3aef8b3ab --- /dev/null +++ b/fuzz/gnutls_base64_decoder_fuzzer.c @@ -0,0 +1,35 @@ +/* +# Copyright 2017 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ +*/ + +#include + +#include +#include "fuzzer.h" + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + gnutls_datum_t raw = {.data = (unsigned char *)data, .size = size}; + gnutls_datum_t out; + int ret; + + ret = gnutls_pem_base64_decode2(NULL, &raw, &out); + if (ret >= 0) + gnutls_free(out.data); + + return 0; +} -- cgit v1.2.1