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
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 23, 2017, 09:15 UTC
Message-ID
<87bmjtwe2n.fsf@evledraar.booking.com>
In-Reply-To
<CAPig+cS_R5wcJQNavGSgNQXtbXNbDsTDhj8cbSZ5BBxRqU8yRQ@mail.gmail.com>
On Wed, Nov 22 2017, Eric Sunshine jotted:
Show 14 quoted lines
> On Wed, Nov 22, 2017 at 8:36 AM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> Fix a bug in the compilation of PCRE2 patterns under JIT (the most
>> common runtime configuration), any pattern with a (*NO_JIT) verb would
>> segfault. This bug dates back to my 94da9193a6 ("grep: add support for
>> PCRE v2", 2017-06-01):
>>
>>     $ git grep -P '(*NO_JIT)hi.*there'
>>     Segmentation fault
>>
>> As explained ad more length in the comment being added here it isn't
>
> s/ad/at/
> s/here/here,/

Thanks. I'll let this sit for a bit and submit a v2 soon. There's also an upstream fix in pcre2 to prevent the segfault that'll be in future versions & I'm going to note in the amended commit message.

Show 10 quoted lines
>> sufficient to just check pcre2_config() to see whether the JIT should
>> be used, pcre2_pattern_info() also has to be asked.
>>
>> This is something I discovered myself when fiddling around with PCRE2
>> verbs in patterns passed to git. I don't expect that any user of git
>> has encountered this given the obscurity of passing PCRE2 verbs
>> through to the library, along with the relative obscurity of (*NO_JIT)
>> itself.
>>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Previous: Eric SunshineNext: Simon Ruderich
Message 4 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.