mirror of
https://github.com/neovim/neovim.git
synced 2026-01-26 23:21:33 +10:00
coverity/102149: Out-of-bounds access: FP.
Problem : Out-of-bounds access @ 5815.
Diagnostic : False positive.
Rationale : Error occurs when event_name2nr() returns NUM_EVENTS, which
means an event with that name was not found. That cannot
happen, as previous check using find_end_event() @ 5744
ensures event name exists.
Resolution : Assert event_name2nr() result is less thatn NUM_EVENTS.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
* fileio.c: read from and write to a file
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
@@ -5811,10 +5812,13 @@ void do_autocmd(char_u *arg, int forceit)
|
||||
nested, cmd, forceit, group) == FAIL)
|
||||
break;
|
||||
} else {
|
||||
while (*arg && !vim_iswhite(*arg))
|
||||
if (do_autocmd_event(event_name2nr(arg, &arg), pat,
|
||||
nested, cmd, forceit, group) == FAIL)
|
||||
while (*arg && !vim_iswhite(*arg)) {
|
||||
event_T event = event_name2nr(arg, &arg);
|
||||
assert(event < NUM_EVENTS);
|
||||
if (do_autocmd_event(event, pat, nested, cmd, forceit, group) == FAIL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (need_free)
|
||||
|
||||
Reference in New Issue
Block a user