diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-25 21:26:17 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-25 21:26:17 +0000 |
commit | 44db8213d38c39877d2148eff6a72f4beccfb94e (patch) | |
tree | eb335ea046fce7c378c65893ddb4ea2c1e27458b /src/register.c | |
parent | 806d037671e133bd28a7864248763f643967973a (diff) | |
download | vim-git-44db8213d38c39877d2148eff6a72f4beccfb94e.tar.gz |
patch 8.2.4219: reading before the start of the linev8.2.4219
Problem: Reading before the start of the line.
Solution: Check boundary before trying to read the character.
Diffstat (limited to 'src/register.c')
-rw-r--r-- | src/register.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/register.c b/src/register.c index d604bae6b..03f7f4ec9 100644 --- a/src/register.c +++ b/src/register.c @@ -1474,7 +1474,7 @@ yank_copy_line(struct block_def *bd, long y_idx, int exclude_trailing_space) { int s = bd->textlen + bd->endspaces; - while (VIM_ISWHITE(*(bd->textstart + s - 1)) && s > 0) + while (s > 0 && VIM_ISWHITE(*(bd->textstart + s - 1))) { s = s - (*mb_head_off)(bd->textstart, bd->textstart + s - 1) - 1; pnew--; |