diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-10-02 18:55:10 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-10-11 17:25:16 +0000 |
| commit | 7a7ba599c3f14c3e86645fc7e23225f513ef5414 (patch) | |
| tree | 4cff89ed01363d3d351e8b73308c3a632e6664a8 | |
| parent | sixel: fold long line (diff) | |
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
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | sixel.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 66a8dc01..7afc1e35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,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 @@ -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, |
