From: K.Kosako Date: Wed, 7 Mar 2018 08:47:08 +0000 (+0900) Subject: add onig_initialize() and onig_end() call for full test X-Git-Tag: v6.8.0~47 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c8badb1cbd3e533692b4ed342950dc3df0e409d;p=onig add onig_initialize() and onig_end() call for full test --- diff --git a/contributed/libfuzzer-onig.cpp b/contributed/libfuzzer-onig.cpp index 984110d..dcd7c63 100644 --- a/contributed/libfuzzer-onig.cpp +++ b/contributed/libfuzzer-onig.cpp @@ -23,9 +23,21 @@ http://llvm.org/docs/LibFuzzer.html extern "C" int LLVMFuzzerTestOneInput(const uint8_t * Data, size_t Size) { regex_t *reg; - if (onig_new - (®, Data, Data + Size, ONIG_OPTION_DEFAULT, ONIG_ENCODING_UTF8, - ONIG_SYNTAX_DEFAULT, 0) == 0) + OnigEncoding enc; + + enc = ONIG_ENCODING_UTF8; + +#ifdef FULL_TEST + onig_initialize(&enc, 1); +#endif + + if (onig_new(®, Data, Data + Size, ONIG_OPTION_DEFAULT, enc, + ONIG_SYNTAX_DEFAULT, 0) == 0) onig_free(reg); + +#ifdef FULL_TEST + onig_end(); +#endif + return 0; }