# HG changeset patch # User Bram Moolenaar # Date 1618687803 -7200 # Node ID 460b04d5897f553cbcd2563a5e17149e853b4e28 # Parent 150cc0a3a8d402d4886d9613ee5b96ae0260629f patch 8.2.2779: memory access error in remove() for blob Commit: https://github.com/vim/vim/commit/f7e92aae1581203306a340b4c0059cc74adea9d6 Author: Bram Moolenaar Date: Sat Apr 17 21:22:49 2021 +0200 patch 8.2.2779: memory access error in remove() for blob Problem: Memory access error in remove() for blob. Solution: Adjust length for memmove(). diff --git a/src/blob.c b/src/blob.c --- a/src/blob.c +++ b/src/blob.c @@ -444,7 +444,7 @@ blob_remove(typval_T *argvars, typval_T { 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; @@ -472,7 +472,8 @@ blob_remove(typval_T *argvars, typval_T 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; } } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2779, +/**/ 2778, /**/ 2777,