From b227cedf82341813514da55baa48511eca4014b0 Mon Sep 17 00:00:00 2001 From: statiolake Date: Sun, 2 May 2021 07:35:52 +0900 Subject: 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 --- src/nvim/sign.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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; -- cgit