• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // © 2019 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 
4 #include <stddef.h>
5 #include <stdint.h>
6 #include <string.h>
7 
8 
9 #include "fuzzer_utils.h"
10 #include "unicode/regex.h"
11 
12 IcuEnvironment* env = new IcuEnvironment();
13 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)14 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
15   UParseError pe = { 0 };
16   UErrorCode status = U_ZERO_ERROR;
17 
18   URegularExpression* re = uregex_open(reinterpret_cast<const UChar*>(data),
19                                        static_cast<int>(size) / sizeof(UChar),
20                                        0, &pe, &status);
21 
22   if (re)
23     uregex_close(re);
24 
25   return 0;
26 }
27