Skip to content

Commit f00b57e

Browse files
committed
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
2 parents b0f8aed + ad7c543 commit f00b57e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt)
421421
static int pcre1match(struct grep_pat *p, const char *line, const char *eol,
422422
regmatch_t *match, int eflags)
423423
{
424-
int ovector[30], ret, flags = 0;
424+
int ovector[30], ret, flags = PCRE_NO_UTF8_CHECK;
425425

426426
if (eflags & REG_NOTBOL)
427427
flags |= PCRE_NOTBOL;

grep.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#include "color.h"
44
#ifdef USE_LIBPCRE1
55
#include <pcre.h>
6+
#ifndef PCRE_NO_UTF8_CHECK
7+
#define PCRE_NO_UTF8_CHECK 0
8+
#endif
69
#ifdef PCRE_CONFIG_JIT
710
#if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
811
#ifndef NO_LIBPCRE1_JIT

0 commit comments

Comments
 (0)