From: Oliver Kiddle <opk@zsh.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Fwd: New Defects reported by Coverity Scan for zsh
Date: Mon, 30 Oct 2023 23:39:24 +0100 [thread overview]
Message-ID: <67611-1698705564.862172@yJ0V.P_S_.gqjr> (raw)
In-Reply-To: <CAH+w=7b7AeiCpw74rKrg_3PhykY826X5Mu=B_+=m4aLw3vzxzw@mail.gmail.com>
On 18 Oct, Bart Schaefer wrote:
> > *** CID 1547827: Null pointer dereferences (FORWARD_NULL)
> > /Src/Modules/pcre.c: 370 in bin_pcre_match()
> > >>> Passing null pointer "named" to "zpcre_get_substrings", which dereferences it.
>
> This is from Oliver's 51738 (PCRE's alternative DFA), I'm not going to
> interpret futher.
The DFA matching doesn't support captures so I wouldn't expect it to
find any. However it counts them at compile time rather than when
matching so explicitly guarding against this condition probably is
needed.
Oliver
diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c
index 96f3c6e65..f5cda6d38 100644
--- a/Src/Modules/pcre.c
+++ b/Src/Modules/pcre.c
@@ -187,7 +187,8 @@ zpcre_get_substrings(pcre2_code *pat, char *arg, pcre2_match_data *mdata,
setaparam(substravar, matches);
}
- if (!pcre2_pattern_info(pat, PCRE2_INFO_NAMECOUNT, &ncount) && ncount
+ if (namedassoc
+ && !pcre2_pattern_info(pat, PCRE2_INFO_NAMECOUNT, &ncount) && ncount
&& !pcre2_pattern_info(pat, PCRE2_INFO_NAMEENTRYSIZE, &nsize)
&& !pcre2_pattern_info(pat, PCRE2_INFO_NAMETABLE, &ntable))
{
prev parent reply other threads:[~2023-10-30 22:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <652dee2ec786c_bbea62e6ad4f459a85503b@prd-scan-dashboard-0.mail>
[not found] ` <CAH+w=7aBWQhr5GjRbEB-kLPggmDViUR=rktKY0xLq-+UvYiqeA@mail.gmail.com>
2023-10-19 4:18 ` Bart Schaefer
2023-10-30 22:39 ` Oliver Kiddle [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67611-1698705564.862172@yJ0V.P_S_.gqjr \
--to=opk@zsh.org \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).