aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--sixel.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f97cb252..cf6a2104 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -88,6 +88,7 @@
built-in terminfo (accessed via XTGETTCAP).
* Crash when interactively resizing the window with a very large
scrollback.
+* Crash when a sixel image exceeds the current sixel max height.
[1173]: https://codeberg.org/dnkl/foot/issues/1173
diff --git a/sixel.c b/sixel.c
index c80a92a3..a824c405 100644
--- a/sixel.c
+++ b/sixel.c
@@ -1295,7 +1295,7 @@ sixel_add_many(struct terminal *term, uint8_t c, unsigned count)
if (unlikely(col + count - 1 >= width)) {
resize_horizontally(term, col + count);
width = term->sixel.image.width;
- count = min(count, width - col);
+ count = min(count, max(width - col, 0));
}
uint32_t color = term->sixel.color;