]> granicus.if.org Git - vim/commitdiff
patch 8.1.1342: using freed memory when joining line with text property v8.1.1342
authorBram Moolenaar <Bram@vim.org>
Fri, 17 May 2019 18:17:40 +0000 (20:17 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 17 May 2019 18:17:40 +0000 (20:17 +0200)
Problem:    Using freed memory when joining line with text property.
Solution:   Use already computed length.

src/ops.c
src/version.c

index d77aa2ef5fb09a45870fdebd22dbaacdad990efd..489c47354499815ff3f9dcfbcaee377c45617c6f 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -4635,7 +4635,7 @@ do_join(
     {
        /* Set the '] mark. */
        curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
-       curwin->w_buffer->b_op_end.col  = (colnr_T)STRLEN(newp);
+       curwin->w_buffer->b_op_end.col  = (colnr_T)sumsize;
     }
 
     /* Only report the change in the first line here, del_lines() will report
index f9329ba8c4bcf41e34fa9673fe0db846d40a916f..07db364bf375013a6634ef248427a554e58c2ff5 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1342,
 /**/
     1341,
 /**/