2015-01-29 16:58:29 +00:00
|
|
|
//===- FuzzerMain.cpp - main() function and flags -------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// main() and flags.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-02-19 18:45:37 +00:00
|
|
|
#include "FuzzerInterface.h"
|
2015-01-29 16:58:29 +00:00
|
|
|
#include "FuzzerInternal.h"
|
|
|
|
|
2016-01-16 01:23:12 +00:00
|
|
|
extern "C" {
|
2015-02-19 18:45:37 +00:00
|
|
|
// This function should be defined by the user.
|
2016-01-16 01:23:12 +00:00
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
|
|
|
|
// This function may optionally be defined by the user.
|
|
|
|
__attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv);
|
|
|
|
} // extern "C"
|
2015-01-31 01:14:40 +00:00
|
|
|
|
2015-01-29 16:58:29 +00:00
|
|
|
int main(int argc, char **argv) {
|
2016-01-16 01:23:12 +00:00
|
|
|
if (LLVMFuzzerInitialize)
|
|
|
|
LLVMFuzzerInitialize(&argc, &argv);
|
2015-05-06 22:19:00 +00:00
|
|
|
return fuzzer::FuzzerDriver(argc, argv, LLVMFuzzerTestOneInput);
|
2015-01-29 16:58:29 +00:00
|
|
|
}
|