summaryrefslogtreecommitdiff
path: root/build/fuzz/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'build/fuzz/main.c')
-rw-r--r--build/fuzz/main.c44
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);
+}