Re: [PATCH 2/2] grep: fix segfault under -P + PCRE2 + (*NO_JIT)
- From
Simon Ruderich <simon@ruderich.org>
- Date
- Nov 23, 2017, 09:10 UTC
- Message-ID
- <20171123091040.GA8095@ruderich.org>
- In-Reply-To
- <20171122133630.18931-2-avarab@gmail.com>
On Wed, Nov 22, 2017 at 01:36:30PM +0000, Ævar Arnfjörð Bjarmason wrote:
Show 11 quoted lines
> + *
> + * This is because if the pattern contains the
> + * (*NO_JIT) verb (see pcre2syntax(3))
> + * pcre2_jit_compile() will exit early with 0. If we
> + * then proceed to call pcre2_jit_match() further down
> + * the line instead of pcre2_match() we'll segfault.
> + */
> + patinforet = pcre2_pattern_info(p->pcre2_pattern, PCRE2_INFO_JITSIZE, &jitsizearg);
> + if (patinforet)
> + die("BUG: The patinforet variable should be 0 after the pcre2_pattern_info() call, not %d",
> + patinforet);I think BUG() should be used here, and maybe shorten the error message:
BUG("pcre2_pattern_info() failed: %d", patinforet);Regards Simon
-- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9