diff options
author | Ali Ijaz Sheikh <ofrobots@google.com> | 2016-04-07 14:06:55 -0700 |
---|---|---|
committer | Ali Ijaz Sheikh <ofrobots@google.com> | 2016-04-14 10:03:39 -0700 |
commit | 52af5c4eebf4de8638aef0338bd826656312a02a (patch) | |
tree | 628dc9fb0b558c3a73a2160706fef368876fe548 /deps/v8/test/fuzzer/fuzzer.cc | |
parent | 6e3e8acc7cc7ebd3d67db5ade1247b8b558efe09 (diff) | |
download | android-node-v8-52af5c4eebf4de8638aef0338bd826656312a02a.tar.gz android-node-v8-52af5c4eebf4de8638aef0338bd826656312a02a.tar.bz2 android-node-v8-52af5c4eebf4de8638aef0338bd826656312a02a.zip |
deps: upgrade V8 to 5.0.71.32
* Pick up the branch head for V8 5.0 stable [1]
* Edit v8 gitignore to allow trace_event copy
* Update V8 DEP trace_event as per deps/v8/DEPS [2]
[1] https://chromium.googlesource.com/v8/v8.git/+/3c67831
[2] https://chromium.googlesource.com/chromium/src/base/trace_event/common/+/4b09207e447ae5bd34643b4c6321bee7b76d35f9
Ref: https://github.com/nodejs/node/pull/5945
PR-URL: https://github.com/nodejs/node/pull/6111
Reviewed-By: targos - Michaƫl Zasso <mic.besace@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
Diffstat (limited to 'deps/v8/test/fuzzer/fuzzer.cc')
-rw-r--r-- | deps/v8/test/fuzzer/fuzzer.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/deps/v8/test/fuzzer/fuzzer.cc b/deps/v8/test/fuzzer/fuzzer.cc new file mode 100644 index 0000000000..71a26b86b3 --- /dev/null +++ b/deps/v8/test/fuzzer/fuzzer.cc @@ -0,0 +1,56 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <stddef.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> + +extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv); +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); + +int main(int argc, char* argv[]) { + if (LLVMFuzzerInitialize(&argc, &argv)) { + fprintf(stderr, "Failed to initialize fuzzer target\n"); + return 1; + } + + if (argc < 2) { + fprintf(stderr, "USAGE: %s <input>\n", argv[0]); + return 1; + } + + FILE* input = fopen(argv[1], "rb"); + + if (!input) { + fprintf(stderr, "Failed to open '%s'\n", argv[1]); + return 1; + } + + fseek(input, 0, SEEK_END); + long size = ftell(input); + fseek(input, 0, SEEK_SET); + + uint8_t* data = reinterpret_cast<uint8_t*>(malloc(size)); + if (!data) { + fclose(input); + fprintf(stderr, "Failed to allocate %ld bytes\n", size); + return 1; + } + + size_t bytes_read = fread(data, 1, size, input); + fclose(input); + + if (bytes_read != size) { + free(data); + fprintf(stderr, "Failed to read %s\n", argv[1]); + return 1; + } + + int result = LLVMFuzzerTestOneInput(data, size); + + free(data); + + return result; +} |