1
0
forked from aniani/vim

patch 8.2.3402: invalid memory access when using :retab with large value

Problem:    Invalid memory access when using :retab with large value.
Solution:   Check the number is positive.
This commit is contained in:
Bram Moolenaar
2021-09-04 18:47:28 +02:00
parent 10c83dde55
commit b7081e135a
5 changed files with 34 additions and 21 deletions

View File

@@ -2240,7 +2240,7 @@ ambw_end:
if (errmsg == NULL)
{
int *oldarray = curbuf->b_p_vsts_array;
if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)))
if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)) == OK)
{
if (oldarray)
vim_free(oldarray);
@@ -2279,7 +2279,7 @@ ambw_end:
{
int *oldarray = curbuf->b_p_vts_array;
if (tabstop_set(*varp, &(curbuf->b_p_vts_array)))
if (tabstop_set(*varp, &(curbuf->b_p_vts_array)) == OK)
{
vim_free(oldarray);
#ifdef FEAT_FOLDING