patch 9.1.2010: Missing out-of-memory checks in vim9class.c
Commit:
https://github.com/vim/vim/commit/a90e80411accf01ee55a901d9fd673609de3e6f7
Author: John Marriott <[email protected]>
Date: Mon Dec 22 18:49:43 2025 +0000
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 <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/version.c b/src/version.c
index 28336399b..dd8fdd667 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2010,
/**/
2009,
/**/
diff --git a/src/vim9class.c b/src/vim9class.c
index e5b811b91..409bb50f7 100644
--- a/src/vim9class.c
+++ b/src/vim9class.c
@@ -179,7 +179,10 @@ add_member(
m->ocm_name.length = (size_t)(varname_end - varname);
m->ocm_name.string = vim_strnsave(varname, m->ocm_name.length);
if (m->ocm_name.string == NULL)
+ {
m->ocm_name.length = 0;
+ return FAIL;
+ }
m->ocm_access = has_public ? VIM_ACCESS_ALL
: *varname == '_' ? VIM_ACCESS_PRIVATE : VIM_ACCESS_READ;
if (has_final)
@@ -230,7 +233,10 @@ add_members_to_class(
*m = parent_members[i];
m->ocm_name.string = vim_strnsave(m->ocm_name.string,
m->ocm_name.length);
if (m->ocm_name.string == NULL)
+ {
m->ocm_name.length = 0;
+ return FAIL;
+ }
if (m->ocm_init != NULL)
m->ocm_init = vim_strsave(m->ocm_init);
}
--
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1vXl8W-00AXSv-5v%40256bit.org.