Skip to content

Commit a90e804

Browse files
John Marriottchrisbra
authored andcommitted
patch 9.1.2010: Missing out-of-memory checks in vim9class.c
Problem: Missing out-of-memory checks in vim9class.c (after v9.1.2000) Solution: Return FAIL early (John Marriott) closes: #18991 Signed-off-by: John Marriott <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 7982966 commit a90e804

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
2010,
737739
/**/
738740
2009,
739741
/**/

src/vim9class.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ add_member(
179179
m->ocm_name.length = (size_t)(varname_end - varname);
180180
m->ocm_name.string = vim_strnsave(varname, m->ocm_name.length);
181181
if (m->ocm_name.string == NULL)
182+
{
182183
m->ocm_name.length = 0;
184+
return FAIL;
185+
}
183186
m->ocm_access = has_public ? VIM_ACCESS_ALL
184187
: *varname == '_' ? VIM_ACCESS_PRIVATE : VIM_ACCESS_READ;
185188
if (has_final)
@@ -230,7 +233,10 @@ add_members_to_class(
230233
*m = parent_members[i];
231234
m->ocm_name.string = vim_strnsave(m->ocm_name.string, m->ocm_name.length);
232235
if (m->ocm_name.string == NULL)
236+
{
233237
m->ocm_name.length = 0;
238+
return FAIL;
239+
}
234240
if (m->ocm_init != NULL)
235241
m->ocm_init = vim_strsave(m->ocm_init);
236242
}

0 commit comments

Comments
 (0)