patch 9.0.1492: using uninitialized memory when argument is missing
Problem: Using uninitialized memory when argument is missing.
Solution: Check there are sufficient arguments before the base.
(closes #12302)
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim
index 6d6efe7..c354367 100644
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -458,6 +458,9 @@
call v9.CheckLegacyAndVim9Success(lines)
call v9.CheckLegacyAndVim9Failure(["call printf('123', 3)"], "E767:")
+
+ " this was using uninitialized memory
+ call v9.CheckLegacyAndVim9Failure(["eval ''->printf()"], "E119:")
endfunc
func Test_printf_float()
diff --git a/src/testdir/test_listener.vim b/src/testdir/test_listener.vim
index 413275d..d30add0 100644
--- a/src/testdir/test_listener.vim
+++ b/src/testdir/test_listener.vim
@@ -212,6 +212,8 @@
call assert_fails('call listener_add([])', 'E921:')
call assert_fails('call listener_add("s:StoreListArgs", [])', 'E730:')
call assert_fails('call listener_flush([])', 'E730:')
+
+ call assert_fails('eval ""->listener_add()', 'E119:')
endfunc
func s:StoreBufList(buf, start, end, added, list)