diff options
author | statiolake <statiolake@gmail.com> | 2021-05-02 07:35:52 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-02 00:35:52 +0200 |
commit | b227cedf82341813514da55baa48511eca4014b0 (patch) | |
tree | 9c7b99d418059fc1d02fd7036dc3bab452de36d1 /src | |
parent | 993ca90c9b53033216d4973e2f995b995ed5740e (diff) | |
download | rneovim-b227cedf82341813514da55baa48511eca4014b0.tar.gz rneovim-b227cedf82341813514da55baa48511eca4014b0.tar.bz2 rneovim-b227cedf82341813514da55baa48511eca4014b0.zip |
signs: fix overflow during adjustment on Windows (#14472)
On Windows, `new_lnum + MAXLNUM` causes overflow and as a result the
line number of that sign becomes invalid negative number. This occurs
when the `set signcolumn=yes`, in other words `signcolumn` is not `auto`
and the sign column is less than 2 columns.
The related change was made in the commit
f2ed7605da45eb79a4f7bb89fb19f680fb5a4927. Originally the above addition
is only executed if `amount != MAXLNUM`, so reintroducing this check
fixes the bug and will hardly produces a new bug.
Fixes https://github.com/neovim/neovim/issues/14460
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/sign.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/sign.c b/src/nvim/sign.c index 5c7b497a19..97e64c6c4c 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -742,15 +742,15 @@ void sign_mark_adjust( next = sign->se_next; new_lnum = sign->se_lnum; if (sign->se_lnum >= line1 && sign->se_lnum <= line2) { - if (amount == MAXLNUM && (!is_fixed || signcol >= 2)) { + if (amount != MAXLNUM) { + new_lnum += amount; + } else if (!is_fixed || signcol >= 2) { *lastp = next; if (next) { next->se_prev = last; } xfree(sign); continue; - } else { - new_lnum += amount; } } else if (sign->se_lnum > line2) { new_lnum += amount_after; |