mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-15 05:33:58 -04:00
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.
This commit is contained in:
parent
702d3ae6ca
commit
8ff8ec5b70
2 changed files with 4 additions and 1 deletions
|
|
@ -131,6 +131,8 @@
|
||||||
* Pressing a modifier key while the kitty keyboard protocol is enabled
|
* Pressing a modifier key while the kitty keyboard protocol is enabled
|
||||||
no longer resets the viewport, or clears the selection.
|
no longer resets the viewport, or clears the selection.
|
||||||
* Crash when failing to load an xcursor image ([#1624][1624]).
|
* Crash when failing to load an xcursor image ([#1624][1624]).
|
||||||
|
* Crash when resizing a dynamically sized sixel (no raster
|
||||||
|
attributes), with a non-1:1 aspect ratio.
|
||||||
|
|
||||||
[1531]: https://codeberg.org/dnkl/foot/issues/1531
|
[1531]: https://codeberg.org/dnkl/foot/issues/1531
|
||||||
[1573]: https://codeberg.org/dnkl/foot/issues/1573
|
[1573]: https://codeberg.org/dnkl/foot/issues/1573
|
||||||
|
|
|
||||||
3
sixel.c
3
sixel.c
|
|
@ -1347,8 +1347,9 @@ resize_vertically(struct terminal *term, int new_height)
|
||||||
uint32_t *old_data = term->sixel.image.data;
|
uint32_t *old_data = term->sixel.image.data;
|
||||||
const int width = term->sixel.image.width;
|
const int width = term->sixel.image.width;
|
||||||
const int old_height = term->sixel.image.height;
|
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);
|
xassert(new_height > 0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue