From aa17f0e0c1c8b3f1d6fc8617613c74f07de66fae Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 21 Mar 2024 11:37:09 +0000 Subject: Fix crash if SIXEL colour register is invalid and remove SIXEL images before reflow to avoid a different crash, from Anindya Mukherjee. --- screen-write.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'screen-write.c') diff --git a/screen-write.c b/screen-write.c index 6892d041..a732f093 100644 --- a/screen-write.c +++ b/screen-write.c @@ -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); sixel_free(si); si = new; + + /* Bail out if the image cannot be scaled. */ + if (si == NULL) + return; sixel_size_in_cells(si, &x, &y); } -- cgit v1.2.3