aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-11-12 22:49:29 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-11-15 12:48:29 +0100
commitfaa000edcb97482c4f8adc3f436344584ceca326 (patch)
tree14c930054dd966b905ae070796205381668bc5f9 /src
parent7d3aac2d7111138b288a83005171b7900b8bcddd (diff)
downloadrneovim-faa000edcb97482c4f8adc3f436344584ceca326.tar.gz
rneovim-faa000edcb97482c4f8adc3f436344584ceca326.tar.bz2
rneovim-faa000edcb97482c4f8adc3f436344584ceca326.zip
Fix warnings: spell.c: spell_move_to(): Null arg: FP.
Problem : Argument with 'nonnull' attribute passed null @ 2118. Diagnostic : False positive. Rationale : Error happens when `if (buflen < len + MAXWLEN + 2) {` is not entered on the first iteration, which cannot happen because buflen is 0 on the first iteration, so the condition should always hold. Resolution : Assert existence of buffer with appropiate length after conditional (which prevents previous error path).
Diffstat (limited to 'src')
-rw-r--r--src/nvim/spell.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 38d52a7f53..d52961b799 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -284,6 +284,7 @@
// stored as an offset to the previous number in as
// few bytes as possible, see offset2bytes())
+#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -2096,6 +2097,7 @@ spell_move_to (
buflen = len + MAXWLEN + 2;
buf = xmalloc(buflen);
}
+ assert(buf && buflen >= len + MAXWLEN + 2);
// In first line check first word for Capital.
if (lnum == 1)