From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9324 invoked by alias); 21 Sep 2015 19:18:45 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36580 Received: (qmail 22585 invoked from network); 21 Sep 2015 19:18:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Originating-IP: [80.3.228.158] X-Spam: 0 X-Authority: v=2.1 cv=MJad45tl c=1 sm=1 tr=0 a=P+FLVI8RzFchTbbqTxIDRw==:117 a=P+FLVI8RzFchTbbqTxIDRw==:17 a=NLZqzBF-AAAA:8 a=kj9zAlcOel0A:10 a=x0q7P-gf9PvCheaYFXEA:9 a=CjuIK1q_8ugA:10 Date: Mon, 21 Sep 2015 20:13:06 +0100 From: Peter Stephenson To: Markus Trippelsdorf Cc: zsh-workers@zsh.org Subject: Re: Two issues found with -fsanitize=undefined Message-ID: <20150921201306.0017146b@ntlworld.com> In-Reply-To: <20150917075759.GA24365@x4> References: <20150917075759.GA24365@x4> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 17 Sep 2015 09:57:59 +0200 Markus Trippelsdorf 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; }