summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-11-25 20:40:11 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-25 20:40:11 +0000
commit85be8563fe5aff686e9e30d6afff401ccd976f2a (patch)
tree13342cc8b126fead546b14c2ce6f3279ce53d831
parent4d07253a485819b3a9fd923d263e722ea2109c12 (diff)
patch 8.2.3678: illegal memory accessv8.2.3678
Problem: Illegal memory access. Solution: Ignore changed indent when computing byte offset.
-rw-r--r--src/register.c6
-rw-r--r--src/version.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/register.c b/src/register.c
index 00b8b4bb34..3fc8b6340c 100644
--- a/src/register.c
+++ b/src/register.c
@@ -2099,6 +2099,7 @@ do_put(
else
{
linenr_T new_lnum = new_cursor.lnum;
+ size_t len;
// Insert at least one line. When y_type is MCHAR, break the first
// line in two.
@@ -2211,11 +2212,12 @@ error:
// Put the '] mark on the first byte of the last inserted character.
// Correct the length for change in indent.
curbuf->b_op_end.lnum = new_lnum;
- col = (colnr_T)STRLEN(y_array[y_size - 1]) - lendiff;
+ len = STRLEN(y_array[y_size - 1]);
+ col = (colnr_T)len - lendiff;
if (col > 1)
curbuf->b_op_end.col = col - 1
- mb_head_off(y_array[y_size - 1],
- y_array[y_size - 1] + col - 1);
+ y_array[y_size - 1] + len - 1);
else
curbuf->b_op_end.col = 0;
diff --git a/src/version.c b/src/version.c
index 0adbdb797c..b7a93edbb2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3678,
+/**/
3677,
/**/
3676,