mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
Prevent null-pointer deference during vim_eval #785
If the eval_expr call in vim_eval returns NULL, a null-pointer deference would happen a few frames down, in vim_to_object_rec
This commit is contained in:

committed by
Justin M. Keyes

parent
d2dfa8523e
commit
785b16d905
@@ -61,6 +61,10 @@ Object vim_eval(String str, Error *err)
|
||||
try_start();
|
||||
typval_T *expr_result = eval_expr((char_u *) str.data, NULL);
|
||||
|
||||
if (!expr_result) {
|
||||
set_api_error("Failed to eval expression", err);
|
||||
}
|
||||
|
||||
if (!try_end(err)) {
|
||||
// No errors, convert the result
|
||||
rv = vim_to_object(expr_result);
|
||||
|
Reference in New Issue
Block a user