mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-19 05:33:44 -04:00
sixel: fix crash when an explicit sixel size had a height less than 6 pixels
This commit is contained in:
parent
20910abf36
commit
ee3935c371
2 changed files with 2 additions and 4 deletions
|
|
@ -39,6 +39,7 @@
|
||||||
(https://codeberg.org/dnkl/foot/issues/210).
|
(https://codeberg.org/dnkl/foot/issues/210).
|
||||||
* Key mappings for key combinations with `alt`+`return`.
|
* Key mappings for key combinations with `alt`+`return`.
|
||||||
* `footclient` `-m` (`--maximized`) flag being ignored.
|
* `footclient` `-m` (`--maximized`) flag being ignored.
|
||||||
|
* Crash with explicitly sized sixels with a height less than 6 pixels.
|
||||||
|
|
||||||
|
|
||||||
## 1.5.3
|
## 1.5.3
|
||||||
|
|
|
||||||
5
sixel.c
5
sixel.c
|
|
@ -804,9 +804,6 @@ resize(struct terminal *term, int new_width, int new_height)
|
||||||
assert(alloc_new_height >= new_height);
|
assert(alloc_new_height >= new_height);
|
||||||
assert(alloc_new_height - new_height < 6);
|
assert(alloc_new_height - new_height < 6);
|
||||||
|
|
||||||
assert(new_width >= old_width);
|
|
||||||
assert(new_height >= old_height);
|
|
||||||
|
|
||||||
uint32_t *new_data = NULL;
|
uint32_t *new_data = NULL;
|
||||||
|
|
||||||
if (new_width == old_width) {
|
if (new_width == old_width) {
|
||||||
|
|
@ -827,7 +824,7 @@ resize(struct terminal *term, int new_width, int new_height)
|
||||||
new_data = xmalloc(alloc_new_width * alloc_new_height * sizeof(uint32_t));
|
new_data = xmalloc(alloc_new_width * alloc_new_height * sizeof(uint32_t));
|
||||||
|
|
||||||
/* Copy old rows, and initialize new columns to background color */
|
/* Copy old rows, and initialize new columns to background color */
|
||||||
for (int r = 0; r < old_height; r++) {
|
for (int r = 0; r < min(old_height, new_height); r++) {
|
||||||
memcpy(&new_data[r * new_width], &old_data[r * old_width], old_width * sizeof(uint32_t));
|
memcpy(&new_data[r * new_width], &old_data[r * old_width], old_width * sizeof(uint32_t));
|
||||||
|
|
||||||
for (int c = old_width; c < new_width; c++)
|
for (int c = old_width; c < new_width; c++)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue