Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: fuzzers/icu_number_format_fuzzer.cc

Issue 1995823002: [libfuzzer] moving icu fuzzers to //third_party/icu, additional fuzzers. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: nits Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2
3 // Fuzzer for NumberFormat::parse.
4
5 #include <stddef.h>
6 #include <stdint.h>
7 #include <memory>
8 #include "third_party/icu/fuzzers/fuzzer_utils.h"
9 #include "third_party/icu/source/i18n/unicode/numfmt.h"
10
11 IcuEnvironment* env = new IcuEnvironment();
12
13 // Entry point for LibFuzzer.
14 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
15 UErrorCode status = U_ZERO_ERROR;
16
17 auto rng = CreateRng(data, size);
18 const icu::Locale& locale = GetRandomLocale(&rng);
19
20 std::unique_ptr<icu::NumberFormat> fmt(
21 icu::NumberFormat::createInstance(locale, status));
22 if (U_FAILURE(status)) return 0;
23
24 icu::UnicodeString str(reinterpret_cast<const char*>(data), size);
25 icu::Formattable result;
26 fmt->parse(str, result, status);
27
28 return 0;
29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698