0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 9.0.1695: Crash with overlong textprop above

Problem: Crash with overlong textprop above
Solution: Consider only positive padding

closes: #12665
closes: #12661

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2023-08-12 00:14:14 +02:00
parent bacc83009b
commit f1cc4d55b9
4 changed files with 31 additions and 2 deletions

View File

@@ -721,7 +721,7 @@ text_prop_position(
// add 1 for NUL, 2 for when '…' is used
if (n_attr != NULL)
l = alloc(n_used + before + after + padding + 3);
l = alloc(n_used + before + after + (padding > 0 ? padding : 0) + 3);
if (n_attr == NULL || l != NULL)
{
int off = 0;
@@ -801,7 +801,7 @@ text_prop_position(
// n_attr_skip will not be decremented before draw_state is
// WL_LINE
*n_attr_skip = before + padding;
*n_attr_skip = before + (padding > 0 ? padding : 0);
}
}
}