diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-03-06 20:37:16 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-03-11 16:32:56 +0000 |
| commit | 839b7dd32e13c7cae260007cd061a47209674994 (patch) | |
| tree | 821e687292b279d6af9964d820f2155cee956663 | |
| parent | sixel: unhook: make sure image height is within bounds (diff) | |
sixel: resize: don’t resize beyond the current max geometry
| -rw-r--r-- | sixel.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -855,6 +855,20 @@ resize(struct terminal *term, int new_width, int new_height) new_height = (new_height + 6 - 1) / 6 * 6; xassert(new_height % 6 == 0); + if (new_width > term->sixel.max_width) + return false; + + /* + * Last row may be cropped by the max height, but don’t skip that + * last partial row entirely. + * + * I.e if max height is ‘4’, then allow resizing up to 6, to allow + * us to emit that last sixel row. The final image will be cropped + * to the current max geometry in unhook. + */ + if (new_height > (term->sixel.max_height + 5) / 6 * 6) + return false; + uint32_t *new_data = NULL; if (new_width == old_width) { |
