Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[patch] fix a crash in ${:offset:length} substitution
- X-seq: zsh-workers 28637
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: [patch] fix a crash in ${:offset:length} substitution
- Date: Tue, 18 Jan 2011 10:37:12 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=K3VNjGEl+AN49OSwjdQp2wUyfINLBGJqW6mz6Ftd9D8=; b=kRwGxATFxarFjdJ7zhDDFka4kJHPs/VB2CF66B6IkRw33wqi1U/tg6U+Rkp2oi79FN JJK6ytMv1XhyuSvUdXS2HkxRjRxRTLaya5b/UZfI/wy9UF9G9IybCrPTte/1ZE90Vmys oWhngchbL8znWXiqM0ABkKsZE0ESeHvailRgE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=tt4/lr+79ULGCe7huvzSW8vNmTj4cwUEacIwrbhjkYXFF4wQrrfrjUEID3ijJ/HZ4J n0/zW688dXkihtHg5JflzrCjJLk3YT7lSXCmRbDMsqgXBOOyJlR92cicTFDqU5kxUgnv 9ICFm7zRmCfLXEeRq2LsZlZskSWRLxH4lNcVo=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Christian Ruppert reported on IRC that ${foo:0:} crashes, ie nothing
after the second colon, here's a fix. With this, it now produces the
diagnostic
zsh: unrecognized modifier
http://mika.l3ib.org/patches/zsh-0:.patch
commit 70bc02156059277bf98265218d11ffd0c80eea48
Author: Mikael Magnusson <mikachu@xxxxxxxxx>
Date: Tue Jan 18 10:34:50 2011 +0100
Fix crash with ${:0:}
diff --git a/Src/subst.c b/Src/subst.c
index a153f88..377aba8 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2814,12 +2814,14 @@ paramsubst(LinkList l, LinkNode n, char **str,
int qt, int ssub)
zerr("invalid length: %s", check_offset);
return NULL;
}
- length = mathevali(check_offset);
- if (errflag)
- return NULL;
- if (length < (zlong)0) {
- zerr("invalid length: %s", check_offset);
- return NULL;
+ if (check_offset) {
+ length = mathevali(check_offset);
+ if (errflag)
+ return NULL;
+ if (length < (zlong)0) {
+ zerr("invalid length: %s", check_offset);
+ return NULL;
+ }
}
}
if (horrible_offset_hack) {
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author