summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1395
blob: 9b429ed762602d33b5a529a239e378ed4ea4b2a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1395
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1395
Problem:    Saving for undo may access invalid memory. (Dominique Pelle)
Solution:   Set ml_line_len also when returning a constant string.
Files:	    src/memline.c, src/testdir/test_textprop.vim


*** ../vim-8.1.1394/src/memline.c	2019-05-24 18:48:36.766128461 +0200
--- src/memline.c	2019-05-25 22:08:30.059817878 +0200
***************
*** 2573,2585 ****
  	}
  errorret:
  	STRCPY(IObuff, "???");
  	return IObuff;
      }
!     if (lnum <= 0)			/* pretend line 0 is line 1 */
  	lnum = 1;
  
!     if (buf->b_ml.ml_mfp == NULL)	/* there are no lines */
  	return (char_u *)"";
  
      /*
       * See if it is the same line as requested last time.
--- 2573,2589 ----
  	}
  errorret:
  	STRCPY(IObuff, "???");
+ 	buf->b_ml.ml_line_len = 4;
  	return IObuff;
      }
!     if (lnum <= 0)			// pretend line 0 is line 1
  	lnum = 1;
  
!     if (buf->b_ml.ml_mfp == NULL)	// there are no lines
!     {
! 	buf->b_ml.ml_line_len = 1;
  	return (char_u *)"";
+     }
  
      /*
       * See if it is the same line as requested last time.
*** ../vim-8.1.1394/src/testdir/test_textprop.vim	2019-05-24 21:22:25.672809688 +0200
--- src/testdir/test_textprop.vim	2019-05-25 22:00:13.638251158 +0200
***************
*** 766,771 ****
--- 766,780 ----
    new
    call prop_add(1, 1, {'type': 'comment'})
    close
+   call prop_type_delete('comment')
+ endfunc
+ 
+ " Adding a text property to an empty buffer and then editing another
+ func Test_textprop_empty_buffer_next()
+   call prop_type_add("xxx", {})
+   call prop_add(1, 1, {"type": "xxx"})
+   next X
+   call prop_type_delete('xxx')
  endfunc
  
  func Test_textprop_remove_from_buf()
*** ../vim-8.1.1394/src/version.c	2019-05-25 21:52:25.096355509 +0200
--- src/version.c	2019-05-25 22:09:37.191480883 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1395,
  /**/

-- 
'Well, here's something to occupy you and keep your mind off things.'
'It won't work, I have an exceptionally large mind.'
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///