diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2022-03-22 09:17:36 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2022-03-22 09:18:09 -0700 |
commit | 0ca5dcc1c57bcd24ea18628444340faff222ef64 (patch) | |
tree | b18d952c29f8cbf458fe88fddca58d9e1875aa38 /src | |
parent | 70fc166b38933e73a45d5348634e626809a7bd32 (diff) | |
download | grep-0ca5dcc1c57bcd24ea18628444340faff222ef64.tar.gz |
grep: work around PCRE2 bug 2642
Problem reported by Carlo Arenas in:
https://lists.gnu.org/r/grep-devel/2022-03/msg00004.html
* src/pcresearch.c (Pcompile) [PCRE2_MATCH_INVALID_UTF]:
In PCRE2 10.35 and earlier, disable start optimization if doing a
caseless UTF-8 search.
Diffstat (limited to 'src')
-rw-r--r-- | src/pcresearch.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pcresearch.c b/src/pcresearch.c index f332a44f..0cf804d6 100644 --- a/src/pcresearch.c +++ b/src/pcresearch.c @@ -154,6 +154,12 @@ Pcompile (char *pattern, idx_t size, reg_syntax_t ignored, bool exact) #ifdef PCRE2_MATCH_INVALID_UTF /* Consider invalid UTF-8 as a barrier, instead of error. */ flags |= PCRE2_MATCH_INVALID_UTF; + +# if ! (10 < PCRE2_MAJOR + (36 <= PCRE2_MINOR)) + /* Work around PCRE2 bug 2642. */ + if (flags & PCRE2_CASELESS) + flags |= PCRE2_NO_START_OPTIMIZE; +# endif #endif } |