* [patch] fix a crash in ${:offset:length} substitution
@ 2011-01-18 9:37 Mikael Magnusson
0 siblings, 0 replies; only message in thread
From: Mikael Magnusson @ 2011-01-18 9:37 UTC (permalink / raw)
To: zsh workers
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@gmail.com>
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-18 9:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-18 9:37 [patch] fix a crash in ${:offset:length} substitution Mikael Magnusson
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).