mirror of
https://github.com/neovim/neovim.git
synced 2026-01-20 20:21:50 +10:00
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).
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user