mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06: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:
parent
7d3aac2d71
commit
faa000edcb
@ -284,6 +284,7 @@
|
|||||||
// stored as an offset to the previous number in as
|
// stored as an offset to the previous number in as
|
||||||
// few bytes as possible, see offset2bytes())
|
// few bytes as possible, see offset2bytes())
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@ -2096,6 +2097,7 @@ spell_move_to (
|
|||||||
buflen = len + MAXWLEN + 2;
|
buflen = len + MAXWLEN + 2;
|
||||||
buf = xmalloc(buflen);
|
buf = xmalloc(buflen);
|
||||||
}
|
}
|
||||||
|
assert(buf && buflen >= len + MAXWLEN + 2);
|
||||||
|
|
||||||
// In first line check first word for Capital.
|
// In first line check first word for Capital.
|
||||||
if (lnum == 1)
|
if (lnum == 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user