From bfbfb6dbf392373a7f63400986ba9e07adffb6c0 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 11 May 2026 12:00:06 +0100 Subject: [PATCH] Avoid overshooting Sixel height in sixel_parse_write, GitHub issue 5071 from nincsnevem662 at gmail dot com. --- image-sixel.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/image-sixel.c b/image-sixel.c index c37e2cce..cc946cfe 100644 --- a/image-sixel.c +++ b/image-sixel.c @@ -122,19 +122,13 @@ sixel_set_pixel(struct sixel_image *si, u_int x, u_int y, u_int c) static int sixel_parse_write(struct sixel_image *si, u_int ch) { - struct sixel_line *sl; u_int i; - if (sixel_parse_expand_lines(si, si->dy + 6) != 0) - return (1); - sl = &si->lines[si->dy]; - for (i = 0; i < 6; i++) { - if (sixel_parse_expand_line(si, sl, si->dx + 1) != 0) - return (1); - if (ch & (1 << i)) - sl->data[si->dx] = si->dc; - sl++; + if (ch & (1 << i)) { + if (sixel_set_pixel(si, si->dx, si->dy + i, si->dc)) + return (1); + } } return (0); }