0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

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 <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ernie Rael 2024-06-23 09:54:45 +02:00 committed by Christian Brabandt
parent 7b29cc97d6
commit 8625714ac1
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
515,
/**/
514,
/**/

View File

@ -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;