summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/complist.c16
2 files changed, 21 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 74d1e73b5..b2b183c24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-14 Peter Stephenson <pws@csr.com>
+
+ * Jonathan Paisley <jp-www@dcs.gla.ac.uk>: 18513:
+ Src/Zle/complist.c: Work around a bad pointer access after
+ resizing the terminal in menu selection.
+
2003-05-13 Oliver Kiddle <opk@zsh.org>
* 18525: Src/utils.c: add manual UTF-8 conversion as extra
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 5190511bf..ee68a6726 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -395,6 +395,7 @@ static int mnew, mlastcols, mlastlines, mhasstat, mfirstl, mlastm;
static int mlprinted, molbeg = -2, mocol = 0, moline = 0, mstatprinted;
static char *mstatus, *mlistp;
static Cmatch **mtab, **mmtabp;
+static int mtab_been_reallocated;
static Cmgroup *mgtab, *mgtabp;
static struct listcols mcolors;
@@ -1657,6 +1658,8 @@ complistmatches(Hookdef dummy, Chdata dat)
if (mnew) {
int i;
+ mtab_been_reallocated = 1;
+
i = columns * listdat.nlines;
free(mtab);
mtab = (Cmatch **) zalloc(i * sizeof(Cmatch **));
@@ -1934,6 +1937,7 @@ domenuselect(Hookdef dummy, Chdata dat)
Cmatch **p;
Cmgroup *pg;
Thingy cmd;
+ int do_last_key = 0;
Menustack u = NULL;
int i = 0, acc = 0, wishcol = 0, setwish = 0, oe = onlyexpl, wasnext = 0;
int space, lbeg = 0, step = 1, wrap, pl = nlnct, broken = 0, first = 1;
@@ -1999,6 +2003,7 @@ domenuselect(Hookdef dummy, Chdata dat)
mlbeg = 0;
molbeg = -42;
for (;;) {
+ mtab_been_reallocated = 0;
if (mline < 0) {
int x, y;
Cmatch **p = mtab;
@@ -2115,7 +2120,16 @@ domenuselect(Hookdef dummy, Chdata dat)
getk:
- if (!(cmd = getkeycmd()) || cmd == Th(z_sendbreak)) {
+ if (!do_last_key) {
+ cmd = getkeycmd();
+ if (mtab_been_reallocated) {
+ do_last_key = 1;
+ continue;
+ }
+ }
+ do_last_key = 0;
+
+ if (!cmd || cmd == Th(z_sendbreak)) {
zbeep();
molbeg = -1;
break;