From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27775 invoked by alias); 28 Sep 2015 01:55:36 -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: 36668 Received: (qmail 22620 invoked from network); 28 Sep 2015 01:55:35 -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,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=RnkQknIgWy4aWGfjdt0EZ7Qv+x4=; b=JYcdrQ 8nj23FYC/LeunKemRmZgDRxFtY03fsywWFQrt3sL87Q7NozUClHIj4mw5KWDCTbP Cst1J6HZylxkYBhhVc2oqveFh3AgBeyD/Fl/Nr9Bn1Mrs/8eswtdW6CV3WyaUpA9 iyltRsFfcQahXmKs0/cBLeziOr2W6H47MEPcw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=RnkQknIgWy4aWGfjdt0EZ7Qv+x4=; b=mPbeO o0oCX7P6HkHBULFJ1dVGcinv+fvoN03i3RykTzMCZPXexPaFsv/BigmG38ZC52J5 iBZL0OMbfQTkfIffuPTQPqS9BGOJ0WKCPHao1EQtvm9GMW2EiNQxVIPy3YsBFn8O VbC181KvWY/Ujd4EeNksxTSflasaLKV5abIKzc= X-Sasl-enc: cVpJUo8nCQJAz3urTGmRxX558r7KdTngLY3hN+Cp22bf 1443405333 Date: Mon, 28 Sep 2015 01:55:31 +0000 From: Daniel Shahaf To: Bart Schaefer Cc: zsh-workers@zsh.org Subject: Re: ${(z)} split of unmatched, doubled (( Message-ID: <20150928015531.GF1879@tarsus.local2> References: <20150927012337.GD1989@tarsus.local2> <150927090048.ZM25706@torch.brasslantern.com> <20150927235106.GD1879@tarsus.local2> <150927175906.ZM20369@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <150927175906.ZM20369@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) Bart Schaefer wrote on Sun, Sep 27, 2015 at 17:59:06 -0700: > So perhaps this: > > +++ b/Src/lex.c > @@ -785,6 +785,8 @@ gettok(void) > default: > + if (lexflags & LEXFLAGS_ACTIVE) > + tokstr = dyncat("((", tokstr); > return LEXERR; LGTM: I've tested it both manually and under zsh-syntax-highlighting, and it's an improvement in both cases. > > It might be prudent to also test that tokstr != NULL there, but I have > not found a sample input where that occurs. The failure mode when tokstr is NULL is calling strlen/strcpy on a NULL argument, which is formally undefined behaviour and practically will probably just segfault. If we can't prove that tokstr is always non-NULL, I would vote to test it for NULL before using it. Thanks, Daniel