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
index 9f59777..4685dc9 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -444,7 +444,7 @@
{
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 @@
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;
}
}