From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4604 invoked by alias); 17 Apr 2014 18:43:00 -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: 32560 Received: (qmail 899 invoked from network); 17 Apr 2014 18:42:54 -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: <140417114252.ZM22145@torch.brasslantern.com> Date: Thu, 17 Apr 2014 11:42:52 -0700 In-reply-to: <20140416044612.GB24565@ewok> Comments: In reply to Andrew Waldron "SegFault in stringsubst" (Apr 16, 2:46pm) References: <20140416044612.GB24565@ewok> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh workers Subject: Re: SegFault in stringsubst MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Apr 16, 2:46pm, Andrew Waldron wrote: } } There is also a segfault if you accidentally use process substitution } for a function name: } "function <(:) print" segfaults } "function <(:) {:}" does not segfault. 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? diff --git a/Src/exec.c b/Src/exec.c index f16cfd3..d821d16 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2346,7 +2346,7 @@ execsubst(LinkList strs) { if (strs) { prefork(strs, esprefork); - if (esglob) { + if (esglob && !errflag) { LinkList ostrs = strs; globlist(strs, 0); strs = ostrs; @@ -4234,8 +4241,11 @@ execfuncdef(Estate state, UNUSED(int do_exec)) plen = nprg * sizeof(wordcode); len = plen + (npats * sizeof(Patprog)) + nstrs; - if (htok && names) + if (htok && names) { execsubst(names); + if (errflag) + return 1; + } while (!names || (s = (char *) ugetnode(names))) { if (!names) { -- Barton E. Schaefer