patch 9.1.1400: [security]: use-after-free when evaluating tuple fails
Problem: [security]: use-after-free when evaluating tuple fails
Solution: return early in case of an error (Yegappan Lakshmanan)
closes: #17351
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_tuple.vim b/src/testdir/test_tuple.vim
index 875031f..e767851 100644
--- a/src/testdir/test_tuple.vim
+++ b/src/testdir/test_tuple.vim
@@ -1575,6 +1575,17 @@
call v9.CheckSourceSuccess(lines)
endfunc
+" Test for evaluating a recursive tuple that results in an error
+func Test_recursive_tuple_eval_fails()
+ let lines =<< trim END
+ call assert_fails(((((((((((((((('tag xyz', func2(pat, flags, infn)
+ END
+ call v9.CheckSourceLegacyAndVim9Failure(lines, [
+ \ 'E121: Undefined variable: pat',
+ \ 'E1001: Variable not found: pat',
+ \ 'E121: Undefined variable: pat'])
+endfunc
+
" Test for add() with a tuple
func Test_tuple_add()
let lines =<< trim END