Commit 08c51c04 authored by Jonathan Metzman's avatar Jonathan Metzman Committed by Commit Bot

Change empty_fuzzer to reflect good patterns

Don't create Environment outside of LLVMFuzzerTestOneInput.

TBR=mmoroz@chromium.org

Change-Id: I470016153ec30ed09805ef8dce8baa2b8103d8d1
Reviewed-on: https://chromium-review.googlesource.com/c/1318401
Commit-Queue: Jonathan Metzman <metzman@chromium.org>
Reviewed-by: default avatarMax Moroz <mmoroz@chromium.org>
Reviewed-by: default avatarJonathan Metzman <metzman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605413}
parent 18e93ce4
...@@ -7,12 +7,6 @@ ...@@ -7,12 +7,6 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
// Fuzzer entry point.
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Run your code on data.
return 0;
}
// Environment is optional. // Environment is optional.
struct Environment { struct Environment {
Environment() { Environment() {
...@@ -20,6 +14,10 @@ struct Environment { ...@@ -20,6 +14,10 @@ struct Environment {
} }
}; };
Environment* env = new Environment(); // Fuzzer entry point.
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Initialize environment once.
static Environment env;
// Run your code on data.
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment