diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-08 13:04:35 +0100 |
---|---|---|
committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-11 01:43:12 +0100 |
commit | ea1f883b199e957134bcb115184280e7122cadbb (patch) | |
tree | bfbfd72c4cb0fe703ee63d5b4d9c2404ca1a40ab /src | |
parent | 1575642b11a48005563b9fc993325ed6e50d5488 (diff) | |
download | rneovim-ea1f883b199e957134bcb115184280e7122cadbb.tar.gz rneovim-ea1f883b199e957134bcb115184280e7122cadbb.tar.bz2 rneovim-ea1f883b199e957134bcb115184280e7122cadbb.zip |
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`.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_eval.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 3e1672c2e7..fba0b93253 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -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: |