sixel: unhook: make sure image height is within bounds

When we allocate the backing buffer, the number of allocated rows is a
multiple of 6.

When persisting the image, make sure its height does not exceed the
current maximum height.
This commit is contained in:
Daniel Eklöf 2021-03-06 21:31:16 +01:00
parent add30a38f3
commit 8ec0f15a34
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -695,6 +695,10 @@ sixel_reflow(struct terminal *term)
void
sixel_unhook(struct terminal *term)
{
/* The internal buffer always as a row number that is a multiple of 6 */
term->sixel.image.height = min(
term->sixel.image.height, term->sixel.max_height);
int pixel_row_idx = 0;
int pixel_rows_left = term->sixel.image.height;
const int stride = term->sixel.image.width * sizeof(uint32_t);