diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2024-03-04 15:29:04 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2024-03-06 15:36:30 +0000 |
| commit | 8ff8ec5b70da567f28b6e0aba1d09931bd680fb3 (patch) | |
| tree | 73d643a625f676097fcf0b5c83d4fd1cd51420cd /sixel.c | |
| parent | kitty kbd: update handling of locked modifiers (diff) | |
sixel: fix row height calculation in resize_vertically()
In resize_vertically(), we assumed a sixel is 6 pixels tall. This is
mostly true, but not for non-1:1 sixels. Or, to be more precise, not
for sixels where 'pan' != 1.
This caused us to allocate too little backing memory, resulting in a
crash when we later tried to write to the image.
Diffstat (limited to 'sixel.c')
| -rw-r--r-- | sixel.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1347,8 +1347,9 @@ resize_vertically(struct terminal *term, int new_height) uint32_t *old_data = term->sixel.image.data; const int width = term->sixel.image.width; const int old_height = term->sixel.image.height; + const int sixel_row_height = 6 * term->sixel.pan; - int alloc_height = (new_height + 6 - 1) / 6 * 6; + int alloc_height = (new_height + sixel_row_height - 1) / sixel_row_height * sixel_row_height; xassert(new_height > 0); |
