diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-11-23 18:22:40 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-12-01 18:42:57 +0000 |
| commit | ee3935c371370ec10fab04efbf9f7b60374b2a86 (patch) | |
| tree | ff7ccad70199132303258d56bb7c13999349b2f2 /sixel.c | |
| parent | client: fix handling of "-m" command-line flag (diff) | |
sixel: fix crash when an explicit sixel size had a height less than 6 pixels
Diffstat (limited to 'sixel.c')
| -rw-r--r-- | sixel.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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 < 6); - assert(new_width >= old_width); - assert(new_height >= old_height); - uint32_t *new_data = NULL; 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)); /* 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)); for (int c = old_width; c < new_width; c++) |
