[libfuzzer] refactoring of fuzzers
- use correct declaration of target function
- include stddef.h and stdint.h for each fuzzer
- fixes to follow chromium codestyle (remove "(c)", add mandatory linebreaks)
[email protected], [email protected]
BUG=539572
Review URL: https://codereview.chromium.org/1670903003
Cr-Commit-Position: refs/heads/master@{#373869}
diff --git a/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc b/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc
index d275654b..fd9d2835 100644
--- a/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc
@@ -1,17 +1,18 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <string>
#include "base/json/json_reader.h"
#include "base/values.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data,
- unsigned long size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
base::JSONReader reader;
reader.Read(std::string(reinterpret_cast<const char*>(data), size));
return 0;
}
-
diff --git a/testing/libfuzzer/fuzzers/brotli_fuzzer.cc b/testing/libfuzzer/fuzzers/brotli_fuzzer.cc
index 41e5d350..c3048ec 100644
--- a/testing/libfuzzer/fuzzers/brotli_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/brotli_fuzzer.cc
@@ -1,13 +1,14 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "third_party/brotli/dec/decode.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
size_t addend = 0;
if (size > 0)
addend = data[size - 1] & 7;
diff --git a/testing/libfuzzer/fuzzers/courgette_fuzzer.cc b/testing/libfuzzer/fuzzers/courgette_fuzzer.cc
index 43063a9..5888db9 100644
--- a/testing/libfuzzer/fuzzers/courgette_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/courgette_fuzzer.cc
@@ -1,7 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "base/memory/scoped_ptr.h"
#include "courgette/assembly_program.h"
#include "courgette/courgette.h"
@@ -9,7 +12,7 @@
#include "courgette/program_detector.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
scoped_ptr<courgette::AssemblyProgram> prog;
courgette::Status status =
courgette::ParseDetectedExecutable(data, size, &prog);
diff --git a/testing/libfuzzer/fuzzers/dns_record_fuzzer.cc b/testing/libfuzzer/fuzzers/dns_record_fuzzer.cc
index ebfcbaf..dfcaf03e 100644
--- a/testing/libfuzzer/fuzzers/dns_record_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/dns_record_fuzzer.cc
@@ -1,14 +1,14 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <string>
+#include <stddef.h>
+#include <stdint.h>
#include "net/dns/dns_response.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
- std::string out;
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
net::DnsRecordParser parser(data, size, 0);
if (!parser.IsValid()) {
return 0;
diff --git a/testing/libfuzzer/fuzzers/empty_fuzzer.cc b/testing/libfuzzer/fuzzers/empty_fuzzer.cc
index a5cd30c..fb38e802 100644
--- a/testing/libfuzzer/fuzzers/empty_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/empty_fuzzer.cc
@@ -1,13 +1,14 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Empty fuzzer that doesn't do anything. Used as test and documentation.
#include <stddef.h>
+#include <stdint.h>
// Fuzzer entry point.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Run your code on data.
return 0;
}
diff --git a/testing/libfuzzer/fuzzers/es_parser_adts_fuzzer.cc b/testing/libfuzzer/fuzzers/es_parser_adts_fuzzer.cc
index bbb4f57..b3da4076 100644
--- a/testing/libfuzzer/fuzzers/es_parser_adts_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/es_parser_adts_fuzzer.cc
@@ -1,7 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "base/bind.h"
#include "media/formats/mp2t/es_parser_adts.h"
@@ -9,7 +12,7 @@
static void EmitBuffer(scoped_refptr<media::StreamParserBuffer> buffer) {}
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
media::mp2t::EsParserAdts es_parser(base::Bind(&NewAudioConfig),
base::Bind(&EmitBuffer), true);
if (!es_parser.Parse(data, size, media::kNoTimestamp(),
diff --git a/testing/libfuzzer/fuzzers/es_parser_h264_fuzzer.cc b/testing/libfuzzer/fuzzers/es_parser_h264_fuzzer.cc
index ddadf5f..952d719f 100644
--- a/testing/libfuzzer/fuzzers/es_parser_h264_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/es_parser_h264_fuzzer.cc
@@ -1,7 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "base/bind.h"
#include "media/formats/mp2t/es_parser_h264.h"
@@ -9,7 +12,7 @@
static void EmitBuffer(scoped_refptr<media::StreamParserBuffer> buffer) {}
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
media::mp2t::EsParserH264 es_parser(base::Bind(&NewVideoConfig),
base::Bind(&EmitBuffer));
if (!es_parser.Parse(data, size, media::kNoTimestamp(),
diff --git a/testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc b/testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc
index f8eaefd..1e84f6b 100644
--- a/testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc
@@ -1,7 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "base/bind.h"
#include "media/formats/mp2t/es_parser_mpeg1audio.h"
@@ -23,7 +26,7 @@
static void EmitBuffer(scoped_refptr<media::StreamParserBuffer> buffer) {}
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
scoped_refptr<NullMediaLog> media_log(new NullMediaLog());
media::mp2t::EsParserMpeg1Audio es_parser(base::Bind(&NewAudioConfig),
base::Bind(&EmitBuffer), media_log);
diff --git a/testing/libfuzzer/fuzzers/ftp_ctrl_response_fuzzer.cc b/testing/libfuzzer/fuzzers/ftp_ctrl_response_fuzzer.cc
index 3cee91e..227cfa28 100644
--- a/testing/libfuzzer/fuzzers/ftp_ctrl_response_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/ftp_ctrl_response_fuzzer.cc
@@ -1,12 +1,15 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "net/ftp/ftp_ctrl_response_buffer.h"
#include "net/log/net_log.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
const net::BoundNetLog log;
net::FtpCtrlResponseBuffer buffer(log);
if (!buffer.ConsumeData(reinterpret_cast<const char*>(data), size)) {
diff --git a/testing/libfuzzer/fuzzers/ftp_directory_listing_fuzzer.cc b/testing/libfuzzer/fuzzers/ftp_directory_listing_fuzzer.cc
index f222e07..0df1f271 100644
--- a/testing/libfuzzer/fuzzers/ftp_directory_listing_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/ftp_directory_listing_fuzzer.cc
@@ -1,7 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <string>
#include <vector>
@@ -23,7 +26,7 @@
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::string buffer(reinterpret_cast<const char*>(data), size);
std::vector<net::FtpDirectoryListingEntry> entries;
net::ParseFtpDirectoryListing(buffer, base::Time::Now(), &entries);
diff --git a/testing/libfuzzer/fuzzers/gfx_png_image_fuzzer.cc b/testing/libfuzzer/fuzzers/gfx_png_image_fuzzer.cc
index a74a181..f716159 100644
--- a/testing/libfuzzer/fuzzers/gfx_png_image_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/gfx_png_image_fuzzer.cc
@@ -1,14 +1,14 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <string>
+#include <stddef.h>
+#include <stdint.h>
#include "ui/gfx/image/image.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data,
- unsigned long size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
gfx::Image::CreateFrom1xPNGBytes(data, size);
return 0;
}
diff --git a/testing/libfuzzer/fuzzers/http_chunked_decoder_fuzzer.cc b/testing/libfuzzer/fuzzers/http_chunked_decoder_fuzzer.cc
index 896cda8a..1d716e93 100644
--- a/testing/libfuzzer/fuzzers/http_chunked_decoder_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/http_chunked_decoder_fuzzer.cc
@@ -1,13 +1,16 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <vector>
#include "net/http/http_chunked_decoder.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
const char* data_ptr = reinterpret_cast<const char*>(data);
std::vector<char> buffer(data_ptr, data_ptr + size);
net::HttpChunkedDecoder decoder;
diff --git a/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.cc b/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.cc
index 1f2c785..96c88c58 100644
--- a/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/icu_uregex_open_fuzzer.cc
@@ -1,13 +1,14 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium 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 "third_party/icu/source/i18n/unicode/regex.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
UParseError pe = { 0 };
UErrorCode status = U_ZERO_ERROR;
URegularExpression* re = uregex_open(reinterpret_cast<const UChar*>(data),
diff --git a/testing/libfuzzer/fuzzers/language_detection_fuzzer.cc b/testing/libfuzzer/fuzzers/language_detection_fuzzer.cc
index 9f616c05..1545f76 100644
--- a/testing/libfuzzer/fuzzers/language_detection_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/language_detection_fuzzer.cc
@@ -1,8 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <string>
#include "base/strings/string16.h"
@@ -10,7 +12,7 @@
#include "components/translate/core/language_detection/language_detection_util.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size == 0) {
return 0;
}
diff --git a/testing/libfuzzer/fuzzers/libexif_parser_fuzzer.cc b/testing/libfuzzer/fuzzers/libexif_parser_fuzzer.cc
index 1239767..3e15edb 100644
--- a/testing/libfuzzer/fuzzers/libexif_parser_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/libexif_parser_fuzzer.cc
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stdlib.h>
+#include <stddef.h>
+#include <stdint.h>
#include "libexif/exif-data.h"
#include "libexif/exif-system.h"
-extern "C" int LLVMFuzzerTestOneInput(unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
ExifData* exif_data = exif_data_new_from_data(data, size);
exif_data_unref(exif_data);
return 0;
diff --git a/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc b/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc
index 44c1f818..5d6654e2 100644
--- a/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/libpng_read_fuzzer.cc
@@ -2,6 +2,9 @@
// 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 <vector>
#include "base/bind.h"
@@ -10,7 +13,7 @@
#include "third_party/libpng/png.h"
struct BufState {
- const unsigned char *data;
+ const uint8_t* data;
size_t bytes_left;
};
@@ -28,7 +31,7 @@
// Entry point for LibFuzzer.
// Roughly follows the libpng book example:
// http://www.libpng.org/pub/png/book/chapter13.html
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < kPngHeaderSize) {
return 0;
}
@@ -63,7 +66,9 @@
png_set_sig_bytes(png_ptr, kPngHeaderSize);
// libpng error handling.
- if (setjmp(png_ptr->jmpbuf)) { return 0; }
+ if (setjmp(png_ptr->jmpbuf)) {
+ return 0;
+ }
// Reading
png_read_info(png_ptr, info_ptr);
@@ -72,7 +77,9 @@
&png_free, png_ptr, row));
// reset error handler to put png_deleter into scope.
- if (setjmp(png_ptr->jmpbuf)) { return 0; }
+ if (setjmp(png_ptr->jmpbuf)) {
+ return 0;
+ }
png_uint_32 width, height;
int bit_depth, color_type, interlace_type, compression_type;
diff --git a/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc b/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc
index 473a77e6..464a6e9 100644
--- a/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc
@@ -1,17 +1,20 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "libxml/parser.h"
-void ignore (void * ctx, const char * msg, ...) {
+void ignore (void* ctx, const char* msg, ...) {
// Error handler to avoid spam of error messages from libxml parser.
}
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
xmlSetGenericErrorFunc(NULL, &ignore);
- if (auto doc = xmlReadMemory(reinterpret_cast<const char *>(data),
+ if (auto doc = xmlReadMemory(reinterpret_cast<const char*>(data),
static_cast<int>(size), "noname.xml", NULL, 0)) {
xmlFreeDoc(doc);
}
diff --git a/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc b/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc
index eeae9ac..f7f7f986 100644
--- a/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc
@@ -1,7 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "media/formats/mp4/box_reader.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -22,7 +25,7 @@
};
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
bool err;
scoped_refptr<NullMediaLog> media_log(new NullMediaLog());
scoped_ptr<media::mp4::BoxReader> reader(
diff --git a/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc b/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc
index ef1ec53b..d3a11f8 100644
--- a/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/pdfium_fuzzer.cc
@@ -1,11 +1,12 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This fuzzer is simplified & cleaned up pdfium/samples/pdfium_test.cc
-#include <assert.h>
#include <limits.h>
+#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -48,8 +49,8 @@
static void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) { }
static bool RenderPage(const FPDF_DOCUMENT& doc,
- const FPDF_FORMHANDLE& form,
- const int page_index) {
+ const FPDF_FORMHANDLE& form,
+ const int page_index) {
FPDF_PAGE page = FPDF_LoadPage(doc, page_index);
if (!page) {
return false;
@@ -177,7 +178,7 @@
wcstombs(path, wpath, MAX_PATH);
return std::string(path, res);
#else
- char *path = new char[PATH_MAX + 1];
+ char* path = new char[PATH_MAX + 1];
assert(path);
ssize_t sz = readlink("/proc/self/exe", path, PATH_MAX);
assert(sz > 0);
@@ -214,7 +215,7 @@
static TestCase* testCase = new TestCase();
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
RenderPdf(reinterpret_cast<const char*>(data), size);
return 0;
}
diff --git a/testing/libfuzzer/fuzzers/quic_crypto_framer_parse_message_fuzzer.cc b/testing/libfuzzer/fuzzers/quic_crypto_framer_parse_message_fuzzer.cc
index ffe8316..b547f1b 100644
--- a/testing/libfuzzer/fuzzers/quic_crypto_framer_parse_message_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/quic_crypto_framer_parse_message_fuzzer.cc
@@ -1,12 +1,15 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "base/strings/string_piece.h"
#include "net/quic/crypto/crypto_framer.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
base::StringPiece crypto_input(reinterpret_cast<const char *>(data), size);
std::unique_ptr<net::CryptoHandshakeMessage> handshake_message(
net::CryptoFramer::ParseMessage(crypto_input));
diff --git a/testing/libfuzzer/fuzzers/snappy_fuzzer.cc b/testing/libfuzzer/fuzzers/snappy_fuzzer.cc
index 56d1b52c..3bb9b55 100644
--- a/testing/libfuzzer/fuzzers/snappy_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/snappy_fuzzer.cc
@@ -1,14 +1,15 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "third_party/snappy/src/snappy-sinksource.h"
#include "third_party/snappy/src/snappy.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
snappy::ByteArraySource src(reinterpret_cast<const char*>(data), size);
uint32_t len;
// Note: src is invalid after GetUncompressedLength call.
diff --git a/testing/libfuzzer/fuzzers/sqlite3_prepare_v2_fuzzer.cc b/testing/libfuzzer/fuzzers/sqlite3_prepare_v2_fuzzer.cc
index 6a25d0b9..1855968 100644
--- a/testing/libfuzzer/fuzzers/sqlite3_prepare_v2_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/sqlite3_prepare_v2_fuzzer.cc
@@ -1,8 +1,9 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "third_party/sqlite/sqlite3.h"
@@ -11,7 +12,7 @@
}
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < 2)
return 0;
diff --git a/testing/libfuzzer/fuzzers/string_to_int_fuzzer.cc b/testing/libfuzzer/fuzzers/string_to_int_fuzzer.cc
index 03ce095..ca42f67 100644
--- a/testing/libfuzzer/fuzzers/string_to_int_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/string_to_int_fuzzer.cc
@@ -1,7 +1,8 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <string>
@@ -10,7 +11,7 @@
#include "base/strings/string_number_conversions.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::string input(reinterpret_cast<const char*>(data), size);
int out_int;
base::StringToInt(input, &out_int);
diff --git a/testing/libfuzzer/fuzzers/string_tokenizer_fuzzer.cc b/testing/libfuzzer/fuzzers/string_tokenizer_fuzzer.cc
index 3aa6a09..7d033b1 100644
--- a/testing/libfuzzer/fuzzers/string_tokenizer_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/string_tokenizer_fuzzer.cc
@@ -1,13 +1,16 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <string>
#include "base/strings/string_tokenizer.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < 1) {
return 0;
}
diff --git a/testing/libfuzzer/fuzzers/unescape_url_component_fuzzer.cc b/testing/libfuzzer/fuzzers/unescape_url_component_fuzzer.cc
index fd3cc19..0053011c 100644
--- a/testing/libfuzzer/fuzzers/unescape_url_component_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/unescape_url_component_fuzzer.cc
@@ -1,17 +1,18 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <string>
#include "net/base/escape.h"
-
static const int kMaxUnescapeRule = 31;
-
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::string path(reinterpret_cast<const char*>(data), size);
for (int i = 0; i <= kMaxUnescapeRule; i++) {
(void)net::UnescapeURLComponent(path,
diff --git a/testing/libfuzzer/fuzzers/unicode_string_codepage_create_fuzzer.cc b/testing/libfuzzer/fuzzers/unicode_string_codepage_create_fuzzer.cc
index 9e27dd9..9a0e49a 100644
--- a/testing/libfuzzer/fuzzers/unicode_string_codepage_create_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/unicode_string_codepage_create_fuzzer.cc
@@ -1,7 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <algorithm>
#include <array>
#include <vector>
@@ -60,7 +63,7 @@
};
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < 2)
return 0;
diff --git a/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc b/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc
index d9c7c1b..e2e814da6 100644
--- a/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc
@@ -1,7 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "base/at_exit.h"
#include "base/i18n/icu_util.h"
#include "url/gurl.h"
@@ -18,7 +21,7 @@
TestCase* test_case = new TestCase();
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
GURL url(std::string(reinterpret_cast<const char*>(data), size));
return 0;
}
diff --git a/testing/libfuzzer/fuzzers/vp9_parser_fuzzer.cc b/testing/libfuzzer/fuzzers/vp9_parser_fuzzer.cc
index 2fb161b..90b379e 100644
--- a/testing/libfuzzer/fuzzers/vp9_parser_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/vp9_parser_fuzzer.cc
@@ -1,11 +1,14 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 "media/filters/vp9_parser.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
media::Vp9Parser parser;
parser.SetStream(data, static_cast<off_t>(size));
while (true) {
diff --git a/testing/libfuzzer/fuzzers/websocket_frame_parser_fuzzer.cc b/testing/libfuzzer/fuzzers/websocket_frame_parser_fuzzer.cc
index f1d710c7..717a9a4 100644
--- a/testing/libfuzzer/fuzzers/websocket_frame_parser_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/websocket_frame_parser_fuzzer.cc
@@ -1,13 +1,16 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <vector>
#include "net/websockets/websocket_frame_parser.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
net::WebSocketFrameParser parser;
std::vector<scoped_ptr<net::WebSocketFrameChunk>> frame_chunks;
parser.Decode(reinterpret_cast<const char*>(data), size, &frame_chunks);
diff --git a/testing/libfuzzer/fuzzers/zlib_uncompress_fuzzer.cc b/testing/libfuzzer/fuzzers/zlib_uncompress_fuzzer.cc
index 680f8bf0..c408a6b 100644
--- a/testing/libfuzzer/fuzzers/zlib_uncompress_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/zlib_uncompress_fuzzer.cc
@@ -1,14 +1,15 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium 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 <string.h>
#include "third_party/zlib/zlib.h"
// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
const int NUM_ITEMS = 1024 * 1024;
const int BUF_SIZE = NUM_ITEMS * sizeof(uint8_t);
uint8_t *buffer = new uint8_t[NUM_ITEMS];