patch 9.1.1415: potential use-after free when there is an error in 'tabpanel'
Problem: potential use-after free when there is an error in 'tabpanel'
option (@char101, after v9.1.1391)
Solution: check if p_tpl has been set to null before accessing it again.
While at it slightly change starts_with_percent_and_bang() and use the
existing opt_name and opt_scope variables.
fixes: #17364
closes: #17388
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_tabpanel.vim b/src/testdir/test_tabpanel.vim
index 46ebe3b..e0a6a8c 100644
--- a/src/testdir/test_tabpanel.vim
+++ b/src/testdir/test_tabpanel.vim
@@ -529,6 +529,14 @@
catch /^Vim\%((\a\+)\)\=:E117:/
endtry
call assert_true(empty(&tabpanel))
+
+ try
+ set tabpanel=%{my#util#TabPanelHighlight}%t
+ redraw!
+ catch /^Vim\%((\a\+)\)\=:E121:/
+ endtry
+ call assert_true(empty(&tabpanel))
+
set tabpanel&vim
set showtabpanel&vim
endfunc