zsh-workers
 help / color / mirror / code / Atom feed
From: Thorsten Meinecke <kaefer@aglaia.snafu.de>
To: zsh-workers@math.gatech.edu
Subject: Re: hzoli change:  $foo:s//r/
Date: Wed, 16 Aug 1995 16:49:30 +0200 (MET DST)	[thread overview]
Message-ID: <m0sijmd-00007BC@aglaia.snafu.DE> (raw)
In-Reply-To: <199508161159.NAA01707@bolyai.cs.elte.hu> from "Zoltan Hidvegi" at Aug 16, 95 01:59:09 pm

Another very minor problem with Zoltan's substitution code.

If hsubr is non-NULL, and a "bad/no previous substitution" error 
occurs, hsubr is free()d. This may corrupt memory. Example:

  $ PS1='[%!] ' ./zsh -f
  [1] echo $foo:s/x//
  
  [2] echo $foo:s/ //
  zsh: bad substitution
  [3] echo $foo:s/ //
  zsh: attempt to free already free storage

This fix only free()s hsubr when there was *no* error.

--- zsh-2.6-beta10-hzoli10.3/Src/subst.c.orig	Wed Aug 16 16:15:45 1995
+++ zsh-2.6-beta10-hzoli10.3/Src/subst.c	Wed Aug 16 16:37:07 1995
@@ -1461,5 +1461,4 @@
 		c = **ptr;
 		(*ptr)++;
-		zsfree(hsubr);
 		ptr1 = *ptr;
 		del = *ptr1++;
@@ -1481,4 +1480,5 @@
 		    return;
 		}
+		zsfree(hsubr);
 		for (tt = hsubl; *tt; tt++)
 		    if (INULL(*tt))

-- 
Thorsten Meinecke
<kaefer@aglaia.snafu.de>


  reply	other threads:[~1995-08-16 15:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-08-15 12:49 Heading, Anthony
1995-08-15 17:02 ` Zoltan Hidvegi
1995-08-16  1:48   ` Thorsten Meinecke
1995-08-16 11:59     ` Zoltan Hidvegi
1995-08-16 14:49       ` Thorsten Meinecke [this message]
1995-08-16 15:20         ` Zoltan Hidvegi
1995-08-16 16:01           ` Barton E. Schaefer
1995-08-16 18:18           ` Wayne Davison
1995-08-16 18:24             ` Zoltan Hidvegi
1995-08-16 22:22               ` Zefram
1995-08-15 18:36 Heading, Anthony
1995-08-15 17:52 ` Zoltan Hidvegi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m0sijmd-00007BC@aglaia.snafu.DE \
    --to=kaefer@aglaia.snafu.de \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).