forked from aniani/vim
patch 8.2.3902: Vim9: double free with nested :def function
Problem: Vim9: double free with nested :def function. Solution: Pass "line_to_free" from compile_def_function() and make sure cmdlinep is valid.
This commit is contained in:
@@ -1669,6 +1669,26 @@ def Test_error_in_nested_function()
|
||||
assert_fails('FuncWithForwardCall()', 'E1096:', '', 1, 'FuncWithForwardCall')
|
||||
enddef
|
||||
|
||||
def Test_nested_functin_with_nextcmd()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
# Define an outer function
|
||||
def FirstFunction()
|
||||
# Define an inner function
|
||||
def SecondFunction()
|
||||
# the function has a body, a double free is detected.
|
||||
AAAAA
|
||||
|
||||
# enddef followed by | or } followed by # one or more characters
|
||||
enddef|BBBB
|
||||
enddef
|
||||
|
||||
# Compile all functions
|
||||
defcompile
|
||||
END
|
||||
CheckScriptFailure(lines, 'E476: Invalid command: AAAAA')
|
||||
enddef
|
||||
|
||||
def Test_return_type_wrong()
|
||||
CheckScriptFailure([
|
||||
'def Func(): number',
|
||||
|
Reference in New Issue
Block a user