From: "Raphaël Jakse" <raphael.jakse@imag.fr>
To: zsh-workers@zsh.org
Subject: [PATCH] Fix #87 - Segfault fault when autocompleting after ">" in, "!> ."
Date: Mon, 28 Nov 2016 14:06:54 +0100 [thread overview]
Message-ID: <53d2b131-bca8-b968-bf46-fa4e4d801231@imag.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 799 bytes --]
Dear zsh developers,
Bug #87 in the SF bug tracker (which is not used anymore if I understood
correctly) claims that when hitting tab to complete after '>' in the
string "!> cmake ..", zsh crashes. I could reproduce the bug that also
appears with the string "!> .".
Here is a patch that works around this bug by checking whether s is null
in the get_comp_string function (zle_tricky.c) before a code that seems
to assume that s is not null. The get_comp_string function is full of
warnings like "abandon all hopes" and "This function is a nightmare" so
I didn't try to know whether s being null at this point is correct.
It is unclear to me how to send a patch for zsh so please let me know if
something is wrong or if additional steps are necessary to apply this patch.
Best,
Raphaël
[-- Attachment #2: fix-completion-segfault.patch --]
[-- Type: text/x-patch, Size: 956 bytes --]
>From ced2387dc8dc65aecc34ecde29924810126a48be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Jakse?= <raphael.jakse@imag.fr>
Date: Fri, 25 Nov 2016 17:14:39 +0100
Subject: [PATCH] Fix #87 - Segfault when autocompleting after ">" in "!> ."
The fix is a workaround that checks whether s is null in the get_comp_string
function (zle_tricky.c) before a code that seems to assume that s is not null
get_comp_string.
---
Src/Zle/zle_tricky.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index c8d3bb3..18ec47a 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1518,7 +1518,7 @@ get_comp_string(void)
zlemetaline = tmp;
zlemetall = strlen(zlemetaline);
}
- if (t0 != STRING && t0 != TYPESET && inwhat != IN_MATH) {
+ if (!s || (t0 != STRING && t0 != TYPESET && inwhat != IN_MATH)) {
if (tmp) {
tmp = NULL;
linptr = zlemetaline;
--
2.9.3
next reply other threads:[~2016-11-28 13:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20161128134346epcas3p4381b0fc59bb5d7513c81239ac4d11034@epcas3p4.samsung.com>
2016-11-28 13:06 ` Raphaël Jakse [this message]
2016-11-28 16:23 ` Bart Schaefer
2016-11-28 16:57 ` Peter Stephenson
2016-12-09 16:42 ` Raphaël Jakse
2016-12-09 17:22 ` Peter Stephenson
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=53d2b131-bca8-b968-bf46-fa4e4d801231@imag.fr \
--to=raphael.jakse@imag.fr \
--cc=zsh-workers@zsh.org \
/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).