patch 9.1.0515: Vim9: segfault in object_equal() Commit: https://github.com/vim/vim/commit/8625714ac13cba271f60687b33f0b63bd29feba1 Author: Ernie Rael <err...@raelity.com> Date: Sun Jun 23 09:54:45 2024 +0200
patch 9.1.0515: Vim9: segfault in object_equal() Problem: Vim9: segfault in object_equal() Solution: test for object pointer being NULL, before dereferencing them (Ernie Rael) closes: #15085 Signed-off-by: Ernie Rael <err...@raelity.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index c363cf0a9..a043f8c69 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -10502,6 +10502,20 @@ def Test_Object_Compare_With_Recursive_Class_Ref() assert_equal(true, result) END v9.CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + + class C + public var nest: C + endclass + var o1 = C.new() + var o2 = C.new(C.new()) + + var result = o1 == o2 + assert_equal(false, result) + END + v9.CheckScriptSuccess(lines) enddef " Test for using a compound operator from a lambda function in an object method diff --git a/src/version.c b/src/version.c index 391ac7365..357f9c1e3 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 515, /**/ 514, /**/ diff --git a/src/vim9class.c b/src/vim9class.c index 4d0b4e8dd..5d68459de 100644 --- a/src/vim9class.c +++ b/src/vim9class.c @@ -3855,6 +3855,8 @@ object_equal( if (o1 == o2) return TRUE; + if (o1 == NULL || o2 == NULL) + return FALSE; cl1 = o1->obj_class; cl2 = o2->obj_class; -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sLI8t-00CYUY-UK%40256bit.org.