From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26035 invoked by alias); 18 Apr 2014 17:02:17 -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: 32564 Received: (qmail 29248 invoked from network); 18 Apr 2014 17:02: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,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140418100200.ZM23843@torch.brasslantern.com> Date: Fri, 18 Apr 2014 10:02:00 -0700 In-reply-to: <20140418160344.GA10455@ewok> Comments: In reply to Andrew Waldron "Re: SegFault in stringsubst" (Apr 19, 2:03am) References: <20140416044612.GB24565@ewok> <140417114252.ZM22145@torch.brasslantern.com> <20140418160344.GA10455@ewok> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: SegFault in stringsubst MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Apr 19, 2:03am, Andrew Waldron wrote: } } Seems like a similar check should be made for anonymous function } arguments so that lastval will be set? This is beginning to have knock-on effects that concern me. E.g.: * I don't know whether the lastval ternary test is the right thing, or if an unconditional return of 1 is appropriate (should lastval be checked in the code I already committed?); * if we're testing errflag here, we should also do it when evaluating "for" and "select" loops (loop.c), which is pushing a new failure mode pretty far afield from the original bug; * which means I'd be a lot happier if we were detecting this as a syntax error instead of a run-time error, but that may be pretty difficult to do. } 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();