mirror of
https://github.com/neovim/neovim.git
synced 2025-11-25 03:30:37 +00:00
Fix warnings: edit.c: ins_compl_get_exp(): Np dereference (2): FP.
Problems : Dereference of null pointer @ 3615.
Dereference of null pointer @ 3764.
Diagnostic : False positives.
Rationale : `ins_buf` is local static, so maintains value between calls.
This function will be called first when `compl_started` is
false, and in that case it initializes `ins_buf`. After
that, it can be called multiple times with `compl_started`
true, where `ins_buf` will be updated but not to null.
So, when arriving to both points, `ins_buf` should never be
null.
Resolution : Assert `ins_buf` at both points.
This commit is contained in:
@@ -3613,6 +3613,7 @@ static int ins_compl_get_exp(pos_T *ini)
|
||||
* If 'infercase' is set, don't use 'smartcase' here
|
||||
*/
|
||||
save_p_scs = p_scs;
|
||||
assert(ins_buf);
|
||||
if (ins_buf->b_p_inf)
|
||||
p_scs = FALSE;
|
||||
|
||||
@@ -3761,8 +3762,10 @@ static int ins_compl_get_exp(pos_T *ini)
|
||||
compl_started = TRUE;
|
||||
} else {
|
||||
/* Mark a buffer scanned when it has been scanned completely */
|
||||
if (type == 0 || type == CTRL_X_PATH_PATTERNS)
|
||||
if (type == 0 || type == CTRL_X_PATH_PATTERNS) {
|
||||
assert(ins_buf);
|
||||
ins_buf->b_scanned = TRUE;
|
||||
}
|
||||
|
||||
compl_started = FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user