patch 9.0.1942: Vim9: execution stack invalidated with null object
Commit:
https://github.com/vim/vim/commit/c1946267f22efe3ec5eb0a1a914f30782a538983
Author: Yegappan Lakshmanan <[email protected]>
Date: Mon Sep 25 21:00:46 2023 +0200
patch 9.0.1942: Vim9: execution stack invalidated with null object
Problem: Vim9: execution stack invalidated with null object
Solution: Check for a null object before adjusting the execution stack
closes: #13186
Signed-off-by: Christian Brabandt <[email protected]>
Co-authored-by: Yegappan Lakshmanan <[email protected]>
diff --git a/src/version.c b/src/version.c
index 168c10cac..e48c564e8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1942,
/**/
1941,
/**/
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 02a37e8bf..0700eb780 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -535,6 +535,15 @@ call_dfunc(
// If this is an object method, the object is just before the arguments.
typval_T *obj = STACK_TV_BOT(0) - argcount - vararg_count - 1;
+ if (IS_OBJECT_METHOD(ufunc) && !IS_CONSTRUCTOR_METHOD(ufunc)
+ && obj->v_type == VAR_OBJECT && obj->vval.v_object == NULL)
+ {
+ // If this is not a constructor method, then a valid object is
+ // needed.
+ emsg(_(e_using_null_object));
+ return FAIL;
+ }
+
// Check the argument types.
if (check_ufunc_arg_types(ufunc, argcount, vararg_count, ectx) == FAIL)
return FAIL;
@@ -601,15 +610,6 @@ call_dfunc(
// the first local variable.
if (IS_OBJECT_METHOD(ufunc))
{
- if (obj->v_type == VAR_OBJECT && obj->vval.v_object == NULL
- && !IS_CONSTRUCTOR_METHOD(ufunc))
- {
- // If this is not a constructor method, then a valid object is
- // needed.
- emsg(_(e_using_null_object));
- return FAIL;
- }
-
*STACK_TV_VAR(0) = *obj;
obj->v_type = VAR_UNKNOWN;
}
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1qkr2x-00BRMy-Bs%40256bit.org.