Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Two issues found with -fsanitize=undefined
- X-seq: zsh-workers 36580
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Markus Trippelsdorf <markus@xxxxxxxxxxxxxxx>
- Subject: Re: Two issues found with -fsanitize=undefined
- Date: Mon, 21 Sep 2015 20:13:06 +0100
- Cc: zsh-workers@xxxxxxx
- In-reply-to: <20150917075759.GA24365@x4>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20150917075759.GA24365@x4>
On Thu, 17 Sep 2015 09:57:59 +0200
Markus Trippelsdorf <markus@xxxxxxxxxxxxxxx> wrote:
> 2)
> compmatch.c:341:6: runtime error: null pointer passed as argument 2, which is declared to never be null}
> Test ./Y02compmatch.ztst failed: output differs from expected as shown above for:
This might be benign, if the final argument is also zero; this should
tell us.
pws
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index 05ae43a..b5728a5 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -338,8 +338,15 @@ add_match_str(Cmatcher m, char *l, char *w, int wl, int sfx)
char *buf;
buf = (char *) zalloc(blen);
- memcpy(buf, matchbuf, matchbuflen);
- zfree(matchbuf, matchbuflen);
+ if (matchbuf) {
+ memcpy(buf, matchbuf, matchbuflen);
+ zfree(matchbuf, matchbuflen);
+ }
+#ifdef DEBUG
+ else {
+ DPUTS(matchbuflen, "matchbuflen with no matchbuf");
+ }
+#endif
matchbuf = buf;
matchbuflen = blen;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author