Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [[ -v a[key] ]] syntax memory leak & undefined associative array keys detected as set
- X-seq: zsh-workers 42805
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Anssi Palin <Anssi.Palin@xxxxxxxxxxxx>
- Subject: Re: [[ -v a[key] ]] syntax memory leak & undefined associative array keys detected as set
- Date: Sat, 19 May 2018 10:49:06 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1526719750; bh=yQyUys8t+W3qjWNuWcbreomatL29LvmuFj9IVrBpapA=; h=From:References:To:Subject:Date:From:Subject; b=DfrRYoxgkw931QhDelyW87UXElf2VNXpoc9QMSp+pbYAwqW0IIYp2YDWAE786VfjviU0/Ipmt9TnXVPMZnw/X8Xw7wBUaft/wuBK1eJWhjjltKIU4vY6i5NRBjYyrAatdwCzmV6ILYtX/Fb0LCwXY7TGHbO7b5u/uuwrEx3chtj266/ykaItsJPVC0Y54cDGXMDu6F7Tg5w2BuzMifb8K3sK9gbO25p31pu7innlMhJB2gQoWMgr2qX9c7pe1TrTS7X1LhnSgCzU6jqvqgHccIWn5ckiNPj1ZiRraYj8n56ODIcYjEZPHGu8CbVo2Dmvx+LCFk8esgcMBe3Pto0XkQ==
- In-reply-to: <HE1PR05MB183333C4D7750364A8B01D0CD7900@HE1PR05MB1833.eurprd05.prod.outlook.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <HE1PR05MB183333C4D7750364A8B01D0CD7900@HE1PR05MB1833.eurprd05.prod.outlook.com>
Anssi Palin wrote:
>
> In workers/41719 I wrote about a memory leak with the (( ${+a[key]} )) syntax.
> While the issue has since been patched I've now noticed that the alternative
> [[ -v a[key] ]] syntax still suffers from the same problem in 5.5.1.
After looking at the patch for the first issue, I tried the following
and it does fix the issue for [[ -v a[key] ]].
+++ b/Src/params.c
@@ -691,7 +691,7 @@ issetvar(char *name)
- if (!(v = getvalue(&vbuf, &name, 1)) || *name)
+ if (!(v = fetchvalue(&vbuf, &name, 1, SCANPM_CHECKING)) || *name)
However, the problem seems to even occur for something like
: ${a[$i]}
We need to differentiate anything that does assignment and should create
the parameter if it isn't already there.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author