Commit 3f560170 authored by aizatsky's avatar aizatsky Committed by Commit bot

[libfuzzer] remove icu fuzzers (moved to //third_party/icu/fuzzers).

(Counterpart to https://codereview.chromium.org/1995823002)

BUG=539572

Review-Url: https://codereview.chromium.org/1995833002
Cr-Commit-Position: refs/heads/master@{#397838}
parent 0333e3ae
......@@ -740,6 +740,7 @@ group("gn_only") {
deps += [
"//testing/libfuzzer/fuzzers",
"//testing/libfuzzer/tests:libfuzzer_tests",
"//third_party/icu/fuzzers",
]
}
......
......@@ -183,15 +183,6 @@ fuzzer_test("libxml_xml_read_memory_fuzzer") {
dict = "dicts/xml.dict"
}
fuzzer_test("unicode_string_codepage_create_fuzzer") {
sources = [
"unicode_string_codepage_create_fuzzer.cc",
]
deps = [
"//third_party/icu",
]
}
fuzzer_test("libpng_read_fuzzer") {
sources = [
"libpng_read_fuzzer.cc",
......@@ -203,17 +194,6 @@ fuzzer_test("libpng_read_fuzzer") {
dict = "dicts/png.dict"
}
fuzzer_test("icu_uregex_open_fuzzer") {
sources = [
"icu_uregex_open_fuzzer.cc",
]
deps = [
"//third_party/icu",
]
dict = "dicts/icu_regex.dict"
libfuzzer_options = [ "max_len=128" ]
}
fuzzer_test("v8_script_parser_fuzzer") {
sources = []
deps = [
......
# 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.
"\\a"
"\\A"
"\\b"
"\\B"
"\\cX"
"\\cC"
"\\cZ"
"\\d"
"\\D"
"\\e"
"\\u001B"
"\\E"
"\\f"
"\\u000C"
"\\G"
"\\h"
"\\u0009"
"\\H"
"\\k"
"\\n"
"\\N"
"\\p"
"\\P"
"{"
"}"
"\\Q"
"\\r"
"\\u000D"
"\\R"
"\\u000a"
"\\u000b"
"\\u000c"
"\\u000d"
"\\u0085"
"\\u2028"
"\\u2029"
"\\s"
"[\\t\\n\\f\\r\\p{Z}]"
"\\S"
"\\t"
"\\u0009"
"\\u"
"\\uf0ff"
"\\U"
"\\U0010ffff."
"\\v"
"\\V"
"\\w"
"\\W"
"\\x"
"\\xhh"
"\\X"
"\\Z"
"\\z"
"\\n"
"\\0"
"\\0ooo"
"."
"^"
"$"
"\\"
"|"
"*"
"+"
"?"
","
"*?"
"+?"
"??"
"*+"
"++"
"?+"
"("
"(?:"
"(?>"
"(?#"
"(?="
"(?!"
"(?<="
"(?<!"
"(?"
"-"
")"
":"
"(?ismwx-ismwx:"
"(?ismwx-ismwx)"
"(?i)"
"["
"]"
"[\\u0000-\\U0010ffff]"
"[:script=Greek:]"
"{script=Greek}"
"gC"
"sc"
"scx"
"WB"
"Nd"
"d"
"MN"
// 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 uint8_t* data, size_t size) {
UParseError pe = { 0 };
UErrorCode status = U_ZERO_ERROR;
URegularExpression* re = uregex_open(reinterpret_cast<const UChar*>(data),
static_cast<int>(size) / sizeof(UChar),
0, &pe, &status);
if (re)
uregex_close(re);
return 0;
}
// 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>
#include "third_party/icu/source/common/unicode/unistr.h"
// Taken from third_party/icu/source/data/mappings/convrtrs.txt file.
static const std::array<const char*, 45> kConverters = {
{
"UTF-8",
"utf-16be",
"utf-16le",
"UTF-32",
"UTF-32BE",
"UTF-32LE",
"ibm866-html",
"iso-8859-2-html",
"iso-8859-3-html",
"iso-8859-4-html",
"iso-8859-5-html",
"iso-8859-6-html",
"iso-8859-7-html",
"iso-8859-8-html",
"ISO-8859-8-I",
"iso-8859-10-html",
"iso-8859-13-html",
"iso-8859-14-html",
"iso-8859-15-html",
"iso-8859-16-html",
"koi8-r-html",
"koi8-u-html",
"macintosh-html",
"windows-874-html",
"windows-1250-html",
"windows-1251-html",
"windows-1252-html",
"windows-1253-html",
"windows-1254-html",
"windows-1255-html",
"windows-1256-html",
"windows-1257-html",
"windows-1258-html",
"x-mac-cyrillic-html",
"windows-936-2000",
"gb18030",
"big5-html",
"euc-jp-html",
"ISO_2022,locale=ja,version=0",
"shift_jis-html",
"euc-kr-html",
"ISO-2022-KR",
"ISO-2022-CN",
"ISO-2022-CN-EXT",
"HZ-GB-2312"
}
};
// Entry point for LibFuzzer.
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < 2)
return 0;
// Need null-terminated string.
std::vector<char> buffer(size, 0);
// First byte will be used for random decisions.
unsigned char selector = data[0];
size -= 1;
std::copy(data + 1, data + size, buffer.data());
// Pointer to a part of fuzzer's data or to some valid codepage value.
char* codepage;
if (selector & 1) {
// Use random codepage value provided by fuzzer (split data in two parts).
// Remove least significant bit because we already used it as input value.
size_t codepage_length = (selector >> 1) & 0xF;
if (size <= codepage_length)
size /= 2;
else
size -= codepage_length;
codepage = buffer.data() + size;
} else {
// Use one of valid codepage values.
// Remove least significant bit because we already used it as input value.
size_t index = (selector >> 1) % kConverters.size();
codepage = const_cast<char*>(kConverters[index]);
}
icu::UnicodeString unicode_string(buffer.data(),
static_cast<int>(size),
codepage);
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