mirror of
https://github.com/neovim/neovim.git
synced 2026-01-21 04:31:51 +10:00
Fix warnings: eval.c: set_var_lval(): Np dereference: FP.
Problem : Dereference of null pointer @ 2273.
Diagnostic : False positive.
Rationale : Suggested error would happen when assigning an rvalue with
more items than the lvalue. Then we would enter conditional
at:
```
if (lp->ll_li->li_next == NULL) {
/* Need to add an empty item. */
list_append_number(lp->ll_list, 0);
}
lp->ll_li = lp->ll_li->li_next;
```
Analyzer thinks the value assigned to lp->ll_li is still
NULL and is hit on the next iteration.
Resolution : Assert lp->ll_li->li_next is not null anymore after
list_append_number().
This commit is contained in:
@@ -2272,6 +2272,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, ch
|
||||
if (lp->ll_li->li_next == NULL) {
|
||||
/* Need to add an empty item. */
|
||||
list_append_number(lp->ll_list, 0);
|
||||
assert(lp->ll_li->li_next);
|
||||
}
|
||||
lp->ll_li = lp->ll_li->li_next;
|
||||
++lp->ll_n1;
|
||||
|
||||
Reference in New Issue
Block a user