mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Fix warnings: ex_eval.c: report_pending(): Np dereference: FP.
Problem : Dereference of null pointer @ 711. Diagnostic : False positive. Rationale : Codepath producing error invokes this function with values `action=RPC_DISCARD, pending=CSTP_FINISH, value=NULL`. Now, for some reason, the analyzer is remembering that `value` is null, and that `action` is `RPC_DISCARD`, but it's not remembering that `pending` is `CSTP_FINISH`. Then, it's taking the wrong branch in the switch for `pending`. That path would never occur invocating the function with those values. Resolution : Assert function precondition between `pending` and `value`. This is, let the compiler know that `value` being null implies `pending` not containing `CSTP_THROW`.
This commit is contained in:
parent
1575642b11
commit
ea1f883b19
@ -9,8 +9,8 @@
|
||||
/*
|
||||
* ex_eval.c: functions for Ex command line for the +eval feature.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "nvim/vim.h"
|
||||
@ -670,6 +670,7 @@ static void report_pending(int action, int pending, void *value)
|
||||
char *s;
|
||||
int save_msg_silent;
|
||||
|
||||
assert(value || !(pending & CSTP_THROW));
|
||||
|
||||
switch (action) {
|
||||
case RP_MAKE:
|
||||
|
Loading…
Reference in New Issue
Block a user