From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18997 invoked by alias); 18 Apr 2014 16:04:16 -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: 32563 Received: (qmail 29102 invoked from network); 18 Apr 2014 16:04:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 Date: Sat, 19 Apr 2014 02:03:44 +1000 From: Andrew Waldron To: zsh-workers@zsh.org Subject: Re: SegFault in stringsubst Message-ID: <20140418160344.GA10455@ewok> Mail-Followup-To: zsh-workers@zsh.org References: <20140416044612.GB24565@ewok> <140417114252.ZM22145@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <140417114252.ZM22145@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:T6r4LqsboM8jTnR1B4a69nVbjA9O7uPCiVWZpCPXA4C+PqlZ7Ph 4xRuu9nsAE1efw3QhWKYpFSdrNm/qoFq4SpTNqpUp6RYsScFFrp2cd89KfdY21wN70+4rKY +x6YZev8z9ebiD6ZqMLZFUvPs45djzZ407cDvRpAYXiTRWOM5JSb7eMASjSy4XPa8Iwadov YaUdW/qgzMP37qZFGxdWw== On Thu, 17 Apr 2014, Bart Schaefer wrote: > Calling zerr() for this only makes sense if the surrounding code pays > attention to errflag. E.g. with the patch from 32552, > > function <(:) print { : } > > emits an error message but defines a function named "print" anyway. > > Anyone see any problems with this addition? > Seems like a similar check should be made for anonymous function arguments so that lastval will be set? diff --git a/Src/exec.c b/Src/exec.c index f16cfd3..36b7efa 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4291,8 +4291,11 @@ execfuncdef(Estate state, UNUSED(int do_exec)) end += *state->pc++; args = ecgetlist(state, *state->pc++, EC_DUPTOK, &htok); - if (htok && args) + if (htok && args) { execsubst(args); + if (errflag) + return lastval ? lastval : 1; + } if (!args) args = newlinklist(); -- Regards, Andrew.