mirror of https://github.com/tmux/tmux.git
Fix crash if SIXEL colour register is invalid and remove SIXEL images before
reflow to avoid a different crash, from Anindya Mukherjee.pull/3915/head
parent
bf5d3f2e26
commit
aa17f0e0c1
|
@ -489,6 +489,9 @@ sixel_print(struct sixel_image *si, struct sixel_image *map, size_t *size)
|
||||||
colours = si->colours;
|
colours = si->colours;
|
||||||
ncolours = si->ncolours;
|
ncolours = si->ncolours;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ncolours == 0)
|
||||||
|
return (NULL);
|
||||||
contains = xcalloc(1, ncolours);
|
contains = xcalloc(1, ncolours);
|
||||||
|
|
||||||
len = 8192;
|
len = 8192;
|
||||||
|
|
2
input.c
2
input.c
|
@ -1839,7 +1839,7 @@ input_csi_dispatch_sm_private(struct input_ctx *ictx)
|
||||||
|
|
||||||
/* Handle CSI graphics SM. */
|
/* Handle CSI graphics SM. */
|
||||||
static void
|
static void
|
||||||
input_csi_dispatch_sm_graphics(struct input_ctx *ictx)
|
input_csi_dispatch_sm_graphics(__unused struct input_ctx *ictx)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_SIXEL
|
#ifdef ENABLE_SIXEL
|
||||||
int n, m, o;
|
int n, m, o;
|
||||||
|
|
|
@ -2283,6 +2283,10 @@ screen_write_sixelimage(struct screen_write_ctx *ctx, struct sixel_image *si,
|
||||||
new = sixel_scale(si, 0, 0, 0, y - sy, sx, sy, 1);
|
new = sixel_scale(si, 0, 0, 0, y - sy, sx, sy, 1);
|
||||||
sixel_free(si);
|
sixel_free(si);
|
||||||
si = new;
|
si = new;
|
||||||
|
|
||||||
|
/* Bail out if the image cannot be scaled. */
|
||||||
|
if (si == NULL)
|
||||||
|
return;
|
||||||
sixel_size_in_cells(si, &x, &y);
|
sixel_size_in_cells(si, &x, &y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
screen.c
6
screen.c
|
@ -308,12 +308,12 @@ screen_resize_cursor(struct screen *s, u_int sx, u_int sy, int reflow,
|
||||||
if (sy != screen_size_y(s))
|
if (sy != screen_size_y(s))
|
||||||
screen_resize_y(s, sy, eat_empty, &cy);
|
screen_resize_y(s, sy, eat_empty, &cy);
|
||||||
|
|
||||||
if (reflow) {
|
|
||||||
#ifdef ENABLE_SIXEL
|
#ifdef ENABLE_SIXEL
|
||||||
image_free_all(s);
|
image_free_all(s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (reflow)
|
||||||
screen_reflow(s, sx, &cx, &cy, cursor);
|
screen_reflow(s, sx, &cx, &cy, cursor);
|
||||||
}
|
|
||||||
|
|
||||||
if (cy >= s->grid->hsize) {
|
if (cy >= s->grid->hsize) {
|
||||||
s->cx = cx;
|
s->cx = cx;
|
||||||
|
|
Loading…
Reference in New Issue