]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/fuzzer/unicode_string_codepage_create_fuzzer.cc
ed75f351c40d4f70c6be52e8bf1a92d9eb141dc2
1 // © 2019 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
11 #include "fuzzer_utils.h"
12 #include "unicode/unistr.h"
14 // Taken from third_party/icu/source/data/mappings/convrtrs.txt file.
15 static const std::array
<const char*, 45> kConverters
= {
50 "x-mac-cyrillic-html",
55 "ISO_2022,locale=ja,version=0",
65 IcuEnvironment
* env
= new IcuEnvironment();
67 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data
, size_t size
) {
72 // First byte is used for random converter selection.
77 std::unique_ptr
<char[]> fuzzbuff(new char[size
]);
78 std::memcpy(fuzzbuff
.get(), data
, size
);
80 icu::UnicodeString
str(fuzzbuff
.get(), size
,
81 kConverters
[rnd
% kConverters
.size()]);