diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-03-30 13:47:12 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-03-30 13:47:12 -0700 |
| commit | d35cd54a23f8114dd6924f705cd125c71b8c1746 (patch) | |
| tree | 2b415e8b6827e0de69c830bf8b7a98d1ca0cac8d | |
| parent | Merge branch 'jc/am-doc-refer-to-format-patch' (diff) | |
| parent | grep: work around UTF-8 related JIT bug in PCRE2 <= 10.34 (diff) | |
| download | git-d35cd54a23f8114dd6924f705cd125c71b8c1746.tar.gz git-d35cd54a23f8114dd6924f705cd125c71b8c1746.zip | |
Merge branch 'mk/workaround-pcre-jit-ucp-bug'
A recent-ish change to allow unicode character classes to be used
with "grep -P" triggered a JIT bug in older pcre2 libraries.
The problematic change in Git built with these older libraries has
been disabled to work around the bug.
* mk/workaround-pcre-jit-ucp-bug:
grep: work around UTF-8 related JIT bug in PCRE2 <= 10.34
| -rw-r--r-- | grep.c | 9 | ||||
| -rw-r--r-- | grep.h | 3 |
2 files changed, 12 insertions, 0 deletions
@@ -321,6 +321,15 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt if (!opt->ignore_locale && is_utf8_locale() && !literal) options |= (PCRE2_UTF | PCRE2_UCP | PCRE2_MATCH_INVALID_UTF); +#ifndef GIT_PCRE2_VERSION_10_35_OR_HIGHER + /* + * Work around a JIT bug related to invalid Unicode character handling + * fixed in 10.35: + * https://github.com/PCRE2Project/pcre2/commit/c21bd977547d + */ + options &= ~PCRE2_UCP; +#endif + #ifndef GIT_PCRE2_VERSION_10_36_OR_HIGHER /* Work around https://bugs.exim.org/show_bug.cgi?id=2642 fixed in 10.36 */ if (PCRE2_MATCH_INVALID_UTF && options & (PCRE2_UTF | PCRE2_CASELESS)) @@ -7,6 +7,9 @@ #if (PCRE2_MAJOR >= 10 && PCRE2_MINOR >= 36) || PCRE2_MAJOR >= 11 #define GIT_PCRE2_VERSION_10_36_OR_HIGHER #endif +#if (PCRE2_MAJOR >= 10 && PCRE2_MINOR >= 35) || PCRE2_MAJOR >= 11 +#define GIT_PCRE2_VERSION_10_35_OR_HIGHER +#endif #if (PCRE2_MAJOR >= 10 && PCRE2_MINOR >= 34) || PCRE2_MAJOR >= 11 #define GIT_PCRE2_VERSION_10_34_OR_HIGHER #endif |
