diff options
author | Christian Brabandt <cb@256bit.org> | 2023-08-12 00:14:14 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-08-12 00:14:14 +0200 |
commit | f1cc4d55b9ed3335985512fb9fedf31cc4bb65a0 (patch) | |
tree | f4a8ee4f08590701d5a3aaa563028e795f52405c /src/drawline.c | |
parent | bacc83009bc38c9ba0247aaa22b76d1993d57993 (diff) |
patch 9.0.1695: Crash with overlong textprop abovev9.0.1695
Problem: Crash with overlong textprop above
Solution: Consider only positive padding
closes: #12665
closes: #12661
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/drawline.c')
-rw-r--r-- | src/drawline.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/drawline.c b/src/drawline.c index 0638c56822..9d6ee8d8db 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -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); } } } |