From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: segfault completing "foo$"
Date: Wed, 22 Aug 2007 17:54:23 +0100 [thread overview]
Message-ID: <20070822175423.0c7aee72@news01.csr.com> (raw)
In-Reply-To: <20070822160237.GA23377@scowler.net>
On Wed, 22 Aug 2007 12:02:37 -0400
Clint Adams <clint@zsh.org> wrote:
> Type "foo$"<TAB><TAB><TAB> (1-3 tabs, depending on setup, I think) to
> segfault zsh.
That's never been properly handled, I don't think, but in 4.2 it didn't
cause a segfault, simply assigned a duff number in the parameter suffix
table. The code implies that could do dire things later on, but I don't
know if it did. Now we actually use the invalid value for creating a
prefix string to analyse, which causes the crash. I think the immediate
fix is simply "don't do that". I don't think parameter completion should
even be active in this case, but there's no way I'm going down that route.
This parq business is in the "not even obscure" category.
Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.71
diff -u -r1.71 compresult.c
--- Src/Zle/compresult.c 28 May 2007 13:08:48 -0000 1.71
+++ Src/Zle/compresult.c 22 Aug 2007 16:47:57 -0000
@@ -1148,7 +1148,7 @@
makesuffixstr(m->remf, m->rems, 1);
}
}
- if (minfo.we && partest && isset(AUTOPARAMKEYS)) {
+ if (minfo.we && partest && isset(AUTOPARAMKEYS) && minfo.insc - parq > 0) {
/* the suffix code needs numbers of characters, not octets */
int outlen;
char *tmpstr = dupstrpfx(zlemetaline + parq, minfo.insc - parq);
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
.
prev parent reply other threads:[~2007-08-22 16:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-22 16:02 Clint Adams
2007-08-22 16:54 ` Peter Stephenson [this message]
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=20070822175423.0c7aee72@news01.csr.com \
--to=pws@csr.com \
--cc=zsh-workers@sunsite.dk \
/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).