summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0194
blob: 36cb442fa6596ad62eae19367a337ce9927e6145 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0194
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.0194
Problem:    Possibly use of NULL pointer. (Coverity)
Solution:   Reset the re_in_use flag earlier.
Files:	    src/regexp.c


*** ../vim-8.1.0193/src/regexp.c	2018-07-17 05:43:50.483214748 +0200
--- src/regexp.c	2018-07-18 06:00:16.581305145 +0200
***************
*** 8266,8271 ****
--- 8266,8272 ----
      rex.reg_endpos = NULL;
  
      result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl);
+     rmp->regprog->re_in_use = FALSE;
  
      /* NFA engine aborted because it's very slow. */
      if (rmp->regprog->re_engine == AUTOMATIC_ENGINE
***************
*** 8284,8290 ****
--- 8285,8295 ----
  #endif
  	    rmp->regprog = vim_regcomp(pat, re_flags);
  	    if (rmp->regprog != NULL)
+ 	    {
+ 		rmp->regprog->re_in_use = TRUE;
  		result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl);
+ 		rmp->regprog->re_in_use = FALSE;
+ 	    }
  	    vim_free(pat);
  	}
  
***************
*** 8294,8300 ****
      rex_in_use = rex_in_use_save;
      if (rex_in_use)
  	rex = rex_save;
-     rmp->regprog->re_in_use = FALSE;
  
      return result > 0;
  }
--- 8299,8304 ----
***************
*** 8382,8387 ****
--- 8386,8392 ----
  
      result = rmp->regprog->engine->regexec_multi(
  				      rmp, win, buf, lnum, col, tm, timed_out);
+     rmp->regprog->re_in_use = FALSE;
  
      /* NFA engine aborted because it's very slow. */
      if (rmp->regprog->re_engine == AUTOMATIC_ENGINE
***************
*** 8409,8416 ****
--- 8414,8425 ----
  #endif
  
  	    if (rmp->regprog != NULL)
+ 	    {
+ 		rmp->regprog->re_in_use = TRUE;
  		result = rmp->regprog->engine->regexec_multi(
  				      rmp, win, buf, lnum, col, tm, timed_out);
+ 		rmp->regprog->re_in_use = FALSE;
+ 	    }
  	    vim_free(pat);
  	}
  	p_re = save_p_re;
***************
*** 8419,8425 ****
      rex_in_use = rex_in_use_save;
      if (rex_in_use)
  	rex = rex_save;
-     rmp->regprog->re_in_use = FALSE;
  
      return result <= 0 ? 0 : result;
  }
--- 8428,8433 ----
*** ../vim-8.1.0193/src/version.c	2018-07-17 05:55:07.031195486 +0200
--- src/version.c	2018-07-18 06:01:05.753045215 +0200
***************
*** 791,792 ****
--- 791,794 ----
  {   /* Add new patch number below this line */
+ /**/
+     194,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
267. You get an extra phone line so you can get phone calls.

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