summaryrefslogtreecommitdiffstats
path: root/screen-write.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2024-03-21 11:37:09 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2024-03-21 11:37:09 +0000
commitaa17f0e0c1c8b3f1d6fc8617613c74f07de66fae (patch)
treeb90b9f0c25c04409339167b9d861eef3c10161f3 /screen-write.c
parentbf5d3f2e26bb9add9e31d72932aea5580be8b653 (diff)
Fix crash if SIXEL colour register is invalid and remove SIXEL images before
reflow to avoid a different crash, from Anindya Mukherjee.
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c4
1 files changed, 4 insertions, 0 deletions
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);
}