Merge branch 'cb/skip-utf8-check-with-pcre1'

Make sure the grep machinery does not abort when seeing a payload
that is not UTF-8 even when JIT is not in use with PCRE1.

* cb/skip-utf8-check-with-pcre1:
  grep: skip UTF8 checks explicitly
This commit is contained in:
Junio C Hamano 2019-10-06 12:25:17 +09:00
commit f00b57e5bc
2 changed files with 4 additions and 1 deletions

2
grep.c
View file

@ -421,7 +421,7 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)
static int pcre1match(struct grep_pat *p, const char *line, const char *eol, static int pcre1match(struct grep_pat *p, const char *line, const char *eol,
regmatch_t *match, int eflags) regmatch_t *match, int eflags)
{ {
int ovector[30], ret, flags = 0; int ovector[30], ret, flags = PCRE_NO_UTF8_CHECK;
if (eflags & REG_NOTBOL) if (eflags & REG_NOTBOL)
flags |= PCRE_NOTBOL; flags |= PCRE_NOTBOL;

3
grep.h
View file

@ -3,6 +3,9 @@
#include "color.h" #include "color.h"
#ifdef USE_LIBPCRE1 #ifdef USE_LIBPCRE1
#include <pcre.h> #include <pcre.h>
#ifndef PCRE_NO_UTF8_CHECK
#define PCRE_NO_UTF8_CHECK 0
#endif
#ifdef PCRE_CONFIG_JIT #ifdef PCRE_CONFIG_JIT
#if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32 #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
#ifndef NO_LIBPCRE1_JIT #ifndef NO_LIBPCRE1_JIT