sixel: overwrite-by-rectangle expects ‘width’ to not exceed screen

This fixes a crash when the emitted sixel extends beyond the right
margin. The crash only happens when there are other sixel images
already emitted.

Fixes part of #151
This commit is contained in:
Daniel Eklöf 2020-10-02 20:55:10 +02:00
parent 7e026ba119
commit 96405c2ca9
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 4 additions and 1 deletions

View file

@ -61,6 +61,8 @@
* Crash when `foot.ini` contains an invalid section name
(https://codeberg.org/dnkl/foot/issues/159).
* Background opacity when in _reverse video_ mode.
* Crash when writing a sixel image that extends outside the terminal's
right margin (https://codeberg.org/dnkl/foot/issues/151).
### Security

View file

@ -482,7 +482,8 @@ sixel_unhook(struct terminal *term)
};
sixel_overwrite_by_rectangle(
term, cursor->row, image.pos.col, image.rows, image.cols);
term, cursor->row, image.pos.col,
image.rows, min(image.cols, term->cols - image.pos.col));
LOG_DBG("generating %dx%d pixman image at %d-%d",
image.width, image.height,