mirror of
https://github.com/neovim/neovim.git
synced 2026-02-08 21:08:47 +00:00
fix(api): parse_expression crash with ident and curly
Problem: nvim_parse_expression null pointer dereference when parsing an
identifier followed by { with "highlight" parameter set to false.
Solution: only set opening_hl_idx if pstate->colors is not NULL.
Not added to parser_tests.lua as that uses highlight = true.
This commit is contained in:
@@ -2636,7 +2636,9 @@ viml_pexpr_parse_figure_brace_closing_error:
|
||||
ADD_IDENT(do {
|
||||
NEW_NODE_WITH_CUR_POS(cur_node,
|
||||
kExprNodeCurlyBracesIdentifier);
|
||||
cur_node->data.fig.opening_hl_idx = kv_size(*pstate->colors);
|
||||
if (pstate->colors) {
|
||||
cur_node->data.fig.opening_hl_idx = kv_size(*pstate->colors);
|
||||
}
|
||||
cur_node->data.fig.type_guesses.allow_lambda = false;
|
||||
cur_node->data.fig.type_guesses.allow_dict = false;
|
||||
cur_node->data.fig.type_guesses.allow_ident = true;
|
||||
|
||||
@@ -3238,9 +3238,11 @@ describe('API', function()
|
||||
end
|
||||
end
|
||||
|
||||
it('does not crash parsing invalid VimL expression #29648', function()
|
||||
it('does not crash parsing invalid VimL expression', function()
|
||||
api.nvim_input(':<C-r>=')
|
||||
api.nvim_input('1bork/')
|
||||
api.nvim_input('1bork/') -- #29648
|
||||
assert_alive()
|
||||
api.nvim_parse_expression('a{b}', '', false)
|
||||
assert_alive()
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user