0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.0089: crash when running out of memory in :setfiletype completion

Problem:    Crash when running out of memory in :setfiletype completion.
Solution:   Do not allocate memory. (Dominique Pelle, closes #5438)
This commit is contained in:
Bram Moolenaar
2020-01-05 22:05:49 +01:00
parent 830c1afc9d
commit f0f8055102
2 changed files with 5 additions and 6 deletions

View File

@@ -2633,16 +2633,13 @@ globpath(
ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options); ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
if (ga_grow(ga, num_p) == OK) if (ga_grow(ga, num_p) == OK)
{ // take over the pointers and put them in "ga"
for (i = 0; i < num_p; ++i) for (i = 0; i < num_p; ++i)
{ {
((char_u **)ga->ga_data)[ga->ga_len] = ((char_u **)ga->ga_data)[ga->ga_len] = p[i];
vim_strnsave(p[i], (int)STRLEN(p[i]));
++ga->ga_len; ++ga->ga_len;
} }
} vim_free(p);
FreeWild(num_p, p);
} }
} }
} }

View File

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