git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 5 of 9 in “test-lib: add LIBPCRE1 & LIBPCRE2 prerequisites”
  1. 1/2 test-lib: add LIBPCRE1 & LIBPCRE2 prerequisitesÆvar Arnfjörð Bjarmason, Nov 22, 2017
  2. 2/2 grep: fix segfault under -P + PCRE2 + (*NO_JIT)Ævar Arnfjörð Bjarmason, Nov 22, 2017
  3. Eric SunshineNov 22, 2017
  4. Ævar Arnfjörð BjarmasonNov 23, 2017
  5. Simon RuderichNov 23, 2017
  6. 1/2 test-lib: add LIBPCRE1 & LIBPCRE2 prerequisitesÆvar Arnfjörð Bjarmason, Nov 23, 2017
  7. 2/2 grep: fix segfault under -P + PCRE2 <=10.30 + (*NO_JIT)Ævar Arnfjörð Bjarmason, Nov 23, 2017
  8. Jonathan NiederNov 22, 2017
  9. Ævar Arnfjörð BjarmasonNov 23, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.