From: K.Kosako Date: Tue, 23 Jul 2019 06:03:23 +0000 (+0900) Subject: divide utf16-be/le from encodings X-Git-Tag: v6.9.3~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=023b927032f2846899f0b66aae7e9ea75fbb1f8c;p=onig divide utf16-be/le from encodings --- diff --git a/harnesses/encode-harness.c b/harnesses/encode-harness.c index 8c103ba..05559fa 100644 --- a/harnesses/encode-harness.c +++ b/harnesses/encode-harness.c @@ -126,12 +126,22 @@ int LLVMFuzzerTestOneInput(const uint8_t * Data, size_t Size) ONIG_ENCODING_CP1251, ONIG_ENCODING_ISO_8859_1, ONIG_ENCODING_UTF8, - ONIG_ENCODING_UTF16_BE, - ONIG_ENCODING_KOI8_R, - ONIG_ENCODING_BIG5 + ONIG_ENCODING_KOI8_R, + ONIG_ENCODING_BIG5 }; + + OnigEncodingType *enc; + +#ifdef UTF16_BE + enc = ONIG_ENCODING_UTF16_BE; +#else +#ifdef UTF16_LE + enc = ONIG_ENCODING_UTF16_LE; +#else int num_encodings = sizeof(encodings)/sizeof(encodings[0]); - OnigEncodingType *enc = encodings[encoding_choice % num_encodings]; + enc = encodings[encoding_choice % num_encodings]; +#endif +#endif r = exec(enc, ONIG_OPTION_NONE, (char *)pattern, (char *)pattern_end, (char *)str, (char *)str_null_end);