Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: [RFC] crash with weird completer



minimal reproducer .zshrc:

  zstyle ':completion:*' completer _oldlist _complete
  setopt nolistambiguous
  autoload compinit; compinit
  compdef _foo foo;_foo() { compadd -Q -- stash@{{0,1}} }

type "foo " and press tab twice, and it should crash.

The patch prevents the crash but I have no further arguments that it's
correct. Also without 'setopt nolistambiguous' we just get an additional
{ inserted for every tab press which also doesn't seem useful (not fixed
by patch).

(Apologies if I've sent this before, looking through local commits that
could potentially be useful to send.)
---
 Src/Zle/compresult.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 8b5955819a..12585e3564 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -608,7 +608,7 @@ instmatch(Cmatch m, int *scs)
     r += l;
     ocs = zlemetacs;
     /* Re-insert the brace beginnings, if any. */
-    if (brbeg) {
+    if (brbeg && m->brpl) {
 	int pcs = zlemetacs;
 
 	l = 0;
-- 
2.15.1





Messages sorted by: Reverse Date, Date, Thread, Author