aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-23 16:15:29 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-23 16:15:29 +0000
commitf6473756d959cfa35c7b9c47a5b66c288b791c86 (patch)
tree7903160d1260913f3c2a0afa773875b705ec9711
parentsixel: overwrite: use target sixel's height, not cell height (diff)
sixel: remove sixel-to-be-splitted *before* splitting it
This fixes an assertion in debug builds, due to the pre-splitted and splitted sixels overlapping.
-rw-r--r--CHANGELOG.md2
-rw-r--r--sixel.c12
2 files changed, 10 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9ee46a87..766d052a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,8 @@
* Crash when overwriting a sixel and the row being overwritten did not
cover an entire cell.
+* Assertion failure in debug builds when overwriting a sixel image.
+
### Security
diff --git a/sixel.c b/sixel.c
index d45bc916..ab9ad0e9 100644
--- a/sixel.c
+++ b/sixel.c
@@ -350,9 +350,11 @@ _sixel_overwrite_by_rectangle(
(col <= col_end && col + width - 1 >= col_end) ||
(col >= col_start && col + width - 1 <= col_end))
{
- sixel_overwrite(term, six, start, col, height, width);
- sixel_erase(term, six);
+ struct sixel to_be_erased = *six;
tll_remove(term->grid->sixel_images, it);
+
+ sixel_overwrite(term, &to_be_erased, start, col, height, width);
+ sixel_erase(term, &to_be_erased);
}
}
}
@@ -421,9 +423,11 @@ sixel_overwrite_by_row(struct terminal *term, int _row, int col, int width)
(col <= col_end && col + width - 1 >= col_end) ||
(col >= col_start && col + width - 1 <= col_end))
{
- sixel_overwrite(term, six, row, col, 1, width);
- sixel_erase(term, six);
+ struct sixel to_be_erased = *six;
tll_remove(term->grid->sixel_images, it);
+
+ sixel_overwrite(term, &to_be_erased, row, col, 1, width);
+ sixel_erase(term, &to_be_erased);
}
}
}