From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22822 invoked from network); 9 May 1998 22:54:33 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 May 1998 22:54:33 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id SAA01128; Sat, 9 May 1998 18:41:43 -0400 (EDT) Resent-Date: Sat, 9 May 1998 18:41:43 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199805092014.PAA01899@hzoli.home> Subject: PATCH: glob coredump fix To: zsh-workers@math.gatech.edu (Zsh hacking and development) Date: Sat, 9 May 1998 15:13:59 -0500 (CDT) X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"FhPru.0.ZH.ckDLr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3961 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu % ./zsh -f % setopt extendedglob % echo ((#)) zsh: bad pattern: ((#)) % echo *.c zsh: 1779 segmentation fault (core dumped) ./zsh -f tail was assumed to be always NULL when pattern parsing was called. 3.0.5 already has this fix. There were significant changes in glob.c since 3.1.2, but this patch still seems to work. Zoli *** Src/glob.c.orig Sat May 9 15:02:46 1998 --- Src/glob.c Sat May 9 15:06:05 1998 *************** struct comp { *** 125,131 **** #define GF_TOPLEV 2 /* outside (), so ~ ends main match */ static char *pptr; /* current place in string being matched */ ! static Comp tail = 0; static int first; /* are leading dots special? */ /**/ --- 125,131 ---- #define GF_TOPLEV 2 /* outside (), so ~ ends main match */ static char *pptr; /* current place in string being matched */ ! static Comp tail; static int first; /* are leading dots special? */ /**/ *************** parsepat(char *str) *** 802,807 **** --- 802,808 ---- { mode = 0; /* path components present */ pptr = str; + tail = NULL; return parsecomplist(); } *************** parsereg(char *str) *** 2434,2439 **** --- 2435,2441 ---- remnulargs(str); mode = 1; /* no path components */ pptr = str; + tail = NULL; return parsecompsw(GF_TOPLEV); }