aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2022-03-29 23:54:02 +0200
committerGitHub <noreply@github.com>2022-03-30 05:54:02 +0800
commite7ac16425c2bcbe26167d89134c51bf412c7b15e (patch)
treec351c79631ae0ac9e354b2f305f4b9805cf78e2d
parenta9665bb12cd8cbacbc6ef6df66c1989b0c6f9fcc (diff)
downloadrneovim-e7ac16425c2bcbe26167d89134c51bf412c7b15e.tar.gz
rneovim-e7ac16425c2bcbe26167d89134c51bf412c7b15e.tar.bz2
rneovim-e7ac16425c2bcbe26167d89134c51bf412c7b15e.zip
vim-patch:8.2.4473: Coverity warns for not checking return value of ftell() (#17914)
Problem: Coverity warns for not checking return value of ftell(). Solution: Bail out if ftell() returns a negative value. https://github.com/vim/vim/commit/416b5f4894196947ea87eea2ed4fda3504674f72
-rw-r--r--src/nvim/spellfile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index d7b220b3f6..07058b34fd 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -5580,6 +5580,9 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
while (!vim_fgets(line, MAXWLEN * 2, fd)) {
fpos = fpos_next;
fpos_next = ftell(fd);
+ if (fpos_next < 0) {
+ break; // should never happen
+ }
if (STRNCMP(word, line, len) == 0
&& (line[len] == '/' || line[len] < ' ')) {
// Found duplicate word. Remove it by writing a '#' at