diff options
author | Daiki Ueno <dueno@redhat.com> | 2017-05-22 15:31:23 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2017-05-22 15:57:52 +0200 |
commit | 8b64577c3bb4d5dd60e4939223550f2f2002284b (patch) | |
tree | d5a63bb8665388d8135d49aa5f29f15304b42cc0 /build/fuzz/main.c | |
parent | 723dfeb3dd9b8426c4c1d6236f4b22354c122dae (diff) |
build: Add fuzzer using AFL
Diffstat (limited to 'build/fuzz/main.c')
-rw-r--r-- | build/fuzz/main.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/build/fuzz/main.c b/build/fuzz/main.c new file mode 100644 index 0000000..6029430 --- /dev/null +++ b/build/fuzz/main.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2017 Nikos Mavrogiannopoulos + * + * Author: Nikos Mavrogiannopoulos + * + * This file is part of GnuTLS. + * + * The GnuTLS is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <string.h> + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); + +int main(int argc, char **argv) +{ + int ret; + unsigned char buf[64*1024]; + + ret = fread(buf, 1, sizeof(buf), stdin); + if (ret <= 0) + return 0; + + return LLVMFuzzerTestOneInput(buf, ret); +} |