about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-10-30 12:57:52 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-10-30 12:57:52 +0000
commit9986ebfd3334ac58f81259d2ec276379c4c020ec (patch)
tree09820e1dc3c182a522ced6fc39bb4bbb6eac88ca
parentff9f2bb88e60e77e8b6d7670ec90651ac4ae5cec (diff)
downloadzsh-9986ebfd3334ac58f81259d2ec276379c4c020ec.tar.gz
zsh-9986ebfd3334ac58f81259d2ec276379c4c020ec.tar.xz
zsh-9986ebfd3334ac58f81259d2ec276379c4c020ec.zip
obscure crash with hasbrpsfx()
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/compresult.c14
2 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 366feb200..d7e6a5472 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-10-27  Peter Stephenson  <pws@csr.com>
+
+	* 22921: Src/compresult.c: obscure crash reveals
+	hasbrpsfx() can be called with line unmetafied.
+
 2006-10-30  Peter Stephenson  <pws@csr.com>
 
 	* 22913: Doc/Zsh/params.yo, Src/jobs.c: set $! after a "bg", too.
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 2dabe2c35..43dce9276 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -683,11 +683,19 @@ instmatch(Cmatch m, int *scs)
 mod_export int
 hasbrpsfx(Cmatch m, char *pre, char *suf)
 {
-    METACHECK();
+    int was_meta;
 
     if (m->flags & CMF_ALL)
 	return 1;
-    else {
+
+    /* May not be metafied if calculating whether to show a list. */
+    if (zlemetaline == NULL) {
+	was_meta = 0;
+	metafy_line();
+    } else
+	was_meta = 1;
+
+    {
 	char *op = lastprebr, *os = lastpostbr;
 	VARARR(char, oline, zlemetall);
 	int oll = zlemetall, ocs = zlemetacs, ole = lastend, opcs = brpcs, oscs = brscs, ret;
@@ -717,6 +725,8 @@ hasbrpsfx(Cmatch m, char *pre, char *suf)
 	lastprebr = op;
 	lastpostbr = os;
 
+	if (!was_meta)
+	    unmetafy_line();
 	return ret;
     }
 }