git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Simon Ruderich <simon@ruderich.org>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/2] grep: fix segfault under -P + PCRE2 + (*NO_JIT)
Date: Thu, 23 Nov 2017 10:10:40 +0100	[thread overview]
Message-ID: <20171123091040.GA8095@ruderich.org> (raw)
In-Reply-To: <20171122133630.18931-2-avarab@gmail.com>

On Wed, Nov 22, 2017 at 01:36:30PM +0000, Ævar Arnfjörð Bjarmason wrote:
> +		 *
> +		 * 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

  parent reply	other threads:[~2017-11-23  9:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 13:36 [PATCH 1/2] test-lib: add LIBPCRE1 & LIBPCRE2 prerequisites Ævar Arnfjörð Bjarmason
2017-11-22 13:36 ` [PATCH 2/2] grep: fix segfault under -P + PCRE2 + (*NO_JIT) Ævar Arnfjörð Bjarmason
2017-11-22 18:18   ` Eric Sunshine
2017-11-23  9:15     ` Ævar Arnfjörð Bjarmason
2017-11-23  9:10   ` Simon Ruderich [this message]
2017-11-23 14:16   ` [PATCH v2 1/2] test-lib: add LIBPCRE1 & LIBPCRE2 prerequisites Ævar Arnfjörð Bjarmason
2017-11-23 14:16   ` [PATCH v2 2/2] grep: fix segfault under -P + PCRE2 <=10.30 + (*NO_JIT) Ævar Arnfjörð Bjarmason
2017-11-22 20:22 ` [PATCH 1/2] test-lib: add LIBPCRE1 & LIBPCRE2 prerequisites Jonathan Nieder
2017-11-23  9:11   ` Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171123091040.GA8095@ruderich.org \
    --to=simon@ruderich.org \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).