diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2015-08-24 22:22:45 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2015-08-29 13:06:49 -0500 |
commit | a07fb98347a8bba47b099ed24aff7aec8fe754aa (patch) | |
tree | 4c221715bdcc848f09ff877529a656b32230c65b /xlib.c | |
parent | 03af1408410e3e1ab0952e1fab6d7acf94b014ef (diff) |
If the cursor was being displayed and its previous position is now outside
the resized window, we could crash when trying to erase the old cursor.
Diffstat (limited to 'xlib.c')
-rw-r--r-- | xlib.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -401,14 +401,17 @@ static void blit_slice(struct uudisp *d, int idx, int x1, int x2) void uudisp_refresh(struct uudisp *d, struct uuterm *t) { struct priv *p = (void *)&d->priv; + int w = t->w < d->w ? t->w : d->w; int h = t->h < d->h ? t->h : d->h; int x1, x2, idx, y; /* Clean up cursor first.. */ if (p->curs_on && (!d->blink || t->x != p->curs_x || t->y != p->curs_y)) { - idx = t->rows[p->curs_y]->idx; - if ((unsigned)p->slices_y[idx] < d->h) - blit_slice(d, idx, p->curs_x, p->curs_x); + if (p->curs_x < w && p->curs_y < h) { + idx = t->rows[p->curs_y]->idx; + if ((unsigned)p->slices_y[idx] < d->h) + blit_slice(d, idx, p->curs_x, p->curs_x); + } p->curs_on = 0; } |