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

patch 9.0.1865: Vim9: garbage collection may cause crash

Problem:  Vim9: garbage collection may cause crash
Solution: validate that class members typeval is not null

closes: #13028

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
Yegappan Lakshmanan
2023-09-04 22:14:28 +02:00
committed by Christian Brabandt
parent 623ba31821
commit 544be0d893
3 changed files with 65 additions and 4 deletions

View File

@@ -5725,10 +5725,15 @@ set_ref_in_item_class(
return FALSE;
cl->class_copyID = copyID;
for (int i = 0; !abort && i < cl->class_class_member_count; ++i)
abort = abort || set_ref_in_item(
&cl->class_members_tv[i],
copyID, ht_stack, list_stack);
if (cl->class_members_tv != NULL)
{
// The "class_members_tv" table is allocated only for regular classes
// and not for interfaces.
for (int i = 0; !abort && i < cl->class_class_member_count; ++i)
abort = abort || set_ref_in_item(
&cl->class_members_tv[i],
copyID, ht_stack, list_stack);
}
for (int i = 0; !abort && i < cl->class_class_function_count; ++i)
abort = abort || set_ref_in_func(NULL,