summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1025
blob: 820624813c9bdfc43ff7b0cb286a07a7008649df (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1025
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.1025
Problem:    Checking NULL pointer after addition. (Coverity)
Solution:   First check for NULL, then add the column.
Files:	    src/regexp.c


*** ../vim-8.1.1024/src/regexp.c	2019-03-02 10:13:36.800974804 +0100
--- src/regexp.c	2019-03-20 21:14:49.926961731 +0100
***************
*** 7784,7792 ****
  	    if (lnum < 0 || rsm.sm_mmatch->endpos[no].lnum < 0)
  		return NULL;
  
! 	    s = reg_getline_submatch(lnum) + rsm.sm_mmatch->startpos[no].col;
! 	    if (s == NULL)  /* anti-crash check, cannot happen? */
  		break;
  	    if (rsm.sm_mmatch->endpos[no].lnum == lnum)
  	    {
  		/* Within one line: take form start to end col. */
--- 7784,7793 ----
  	    if (lnum < 0 || rsm.sm_mmatch->endpos[no].lnum < 0)
  		return NULL;
  
! 	    s = reg_getline_submatch(lnum);
! 	    if (s == NULL)  // anti-crash check, cannot happen?
  		break;
+ 	    s += rsm.sm_mmatch->startpos[no].col;
  	    if (rsm.sm_mmatch->endpos[no].lnum == lnum)
  	    {
  		/* Within one line: take form start to end col. */
*** ../vim-8.1.1024/src/version.c	2019-03-20 20:38:40.378550979 +0100
--- src/version.c	2019-03-20 21:15:30.486656439 +0100
***************
*** 781,782 ****
--- 781,784 ----
  {   /* Add new patch number below this line */
+ /**/
+     1025,
  /**/

-- 
From "know your smileys":
 :-{}	Too much lipstick

 /// 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    ///