zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: [RFC] crash with weird completer
@ 2022-03-08 19:32 Mikael Magnusson
  2022-03-10  5:47 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2022-03-08 19:32 UTC (permalink / raw)
  To: zsh-workers

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-10 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 19:32 PATCH: [RFC] crash with weird completer Mikael Magnusson
2022-03-10  5:47 ` Bart Schaefer
2022-03-10 12:27   ` 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).