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>