scuffed-code/icu4c/source/test/fuzzer/uregex_open_fuzzer.cpp
Norbert Runge 1606c4c586 ICU-20652 Adds Makefile.in, a fuzzer driver, and minor changes to in fuzzer
targets to test/fuzzer/ directory. This will enable compilation and
smoke test of fuzzer targets as part of the ICU continuous build.

ICU-20652 Fixed exit-on-error behaviour of fuzzer targets execution.
Minor clean-ups and improvements

ICU-20652 Modifies fuzzer/Makefile.in to fix Windows build issue.

ICU-20627 Adds explicit enablement of fuzzer targets build to ICU4C
configuration and Makefile.in. File 'configure' was created from
'configure.ac' by executing 'autoreconf'.

autoreconf added some new entries into 'configure' about runstatedir. Not sure
why it did this, they are not related to fuzzer.
2019-06-18 14:43:33 -07:00

27 lines
674 B
C++

// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "fuzzer_utils.h"
#include "unicode/regex.h"
IcuEnvironment* env = new IcuEnvironment();
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;
}