Skip to content

Commit

Permalink
patch 8.2.2779: memory access error in remove() for blob
Browse files Browse the repository at this point in the history
Problem:    Memory access error in remove() for blob.
Solution:   Adjust length for memmove().
  • Loading branch information
brammool committed Apr 17, 2021
1 parent d23b714 commit f7e92aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/blob.c
Expand Up @@ -444,7 +444,7 @@ blob_remove(typval_T *argvars, typval_T *rettv)
{
blob_T *blob;

// Remove range of items, return list with values.
// Remove range of items, return blob with values.
end = (long)tv_get_number_chk(&argvars[2], &error);
if (error)
return;
Expand Down Expand Up @@ -472,7 +472,8 @@ blob_remove(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_BLOB;
rettv->vval.v_blob = blob;

mch_memmove(p + idx, p + end + 1, (size_t)(len - end));
if (len - end - 1 > 0)
mch_memmove(p + idx, p + end + 1, (size_t)(len - end - 1));
b->bv_ga.ga_len -= end - idx + 1;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2779,
/**/
2778,
/**/
Expand Down

0 comments on commit f7e92aa

Please sign in to comment.