patch 9.0.1712: missing null check in object_clear()

3 views
Skip to first unread message

Christian Brabandt

unread,
Aug 13, 2023, 2:15:10 PM8/13/23
to vim...@googlegroups.com
patch 9.0.1712: missing null check in object_clear()

Commit: https://github.com/vim/vim/commit/5b0889b8bf25b0793b1949ec965c94b623900aba
Author: Jia-Ju Bai <baij...@buaa.edu.cn>
Date: Sun Aug 13 20:04:04 2023 +0200

patch 9.0.1712: missing null check in object_clear()

Problem: missing null check in object_clear()
Solution: Add null check of cl

closes: #12627

Signed-off-by: Christian Brabandt <c...@256bit.org>
Co-authored-by: Jia-Ju Bai <baij...@buaa.edu.cn>

diff --git a/src/version.c b/src/version.c
index 3a7d4bb4d..45f5527d1 100644
--- a/src/version.c
+++ b/src/version.c
@@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1712,
/**/
1711,
/**/
diff --git a/src/vim9class.c b/src/vim9class.c
index 2f2422871..562db25b5 100644
--- a/src/vim9class.c
+++ b/src/vim9class.c
@@ -1509,6 +1509,9 @@ object_clear(object_T *obj)

class_T *cl = obj->obj_class;

+ if (!cl)
+ return;
+
// the member values are just after the object structure
typval_T *tv = (typval_T *)(obj + 1);
for (int i = 0; i < cl->class_obj_member_count; ++i)
Reply all
Reply to author
Forward
0 new messages