mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 16:06:16 +01:00
e66277943d
The files have only been touched by a subset of three people: pdknsk, Philip Withnall, and Marc-André Lureau. Their copyrights are assigned to pdknsk, Endless OS Foundation and Red Hat. The default license for GLib at the time of writing these files was (and still is) LGPL-2.1-or-later. `driver.c` came from LLVM and is under a different license: https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/fuzzer/standalone/StandaloneFuzzTargetMain.c. That doesn’t affect the license of GLib overall, since it’s only used for testing during development. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #1415
46 lines
981 B
C
46 lines
981 B
C
/*
|
|
* Copyright 2018 LLVM contributors
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
*
|
|
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
* See https://llvm.org/LICENSE.txt for license information.
|
|
*/
|
|
|
|
/* Simpler gnu89 version of StandaloneFuzzTargetMain.c from LLVM */
|
|
|
|
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
extern int LLVMFuzzerTestOneInput (const unsigned char *data, size_t size);
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
FILE *f;
|
|
long tell_result;
|
|
size_t n_read, len;
|
|
unsigned char *buf;
|
|
|
|
if (argc < 2)
|
|
return 1;
|
|
|
|
f = fopen (argv[1], "r");
|
|
assert (f);
|
|
fseek (f, 0, SEEK_END);
|
|
tell_result = ftell (f);
|
|
assert (tell_result >= 0);
|
|
len = (size_t) tell_result;
|
|
fseek (f, 0, SEEK_SET);
|
|
buf = (unsigned char*) malloc (len);
|
|
n_read = fread (buf, 1, len, f);
|
|
assert (n_read == len);
|
|
LLVMFuzzerTestOneInput (buf, len);
|
|
|
|
free (buf);
|
|
fclose (f);
|
|
printf ("Done!\n");
|
|
return 0;
|
|
}
|