summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1054
blob: cd4844b8614547ae2fe4fa4efb96c2575a4f68d7 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1054
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.1054
Problem:    Not checking return value of ga_grow(). (Coverity)
Solution:   Only append when ga_grow() returns OK.
Files:	    src/if_lua.c


*** ../vim-8.1.1053/src/if_lua.c	2019-03-23 13:56:30.189804811 +0100
--- src/if_lua.c	2019-03-26 21:40:15.851115489 +0100
***************
*** 1144,1152 ****
  	size_t i, l = 0;
  	const char *s = lua_tolstring(L, 2, &l);
  
! 	ga_grow(&b->bv_ga, l);
! 	for (i = 0; i < l; ++i)
! 	    ga_append(&b->bv_ga, s[i]);
      }
      lua_settop(L, 1);
      return 1;
--- 1144,1152 ----
  	size_t i, l = 0;
  	const char *s = lua_tolstring(L, 2, &l);
  
! 	if (ga_grow(&b->bv_ga, l) == OK)
! 	    for (i = 0; i < l; ++i)
! 		ga_append(&b->bv_ga, s[i]);
      }
      lua_settop(L, 1);
      return 1;
***************
*** 1776,1784 ****
  	    size_t i, l = 0;
  	    const char *s = lua_tolstring(L, 1, &l);
  
! 	    ga_grow(&b->bv_ga, l);
! 	    for (i = 0; i < l; ++i)
! 		ga_append(&b->bv_ga, s[i]);
  	}
      }
      return 1;
--- 1776,1784 ----
  	    size_t i, l = 0;
  	    const char *s = lua_tolstring(L, 1, &l);
  
! 	    if (ga_grow(&b->bv_ga, l) == OK)
! 		for (i = 0; i < l; ++i)
! 		    ga_append(&b->bv_ga, s[i]);
  	}
      }
      return 1;
*** ../vim-8.1.1053/src/version.c	2019-03-26 00:31:17.221047734 +0100
--- src/version.c	2019-03-26 21:41:01.734718469 +0100
***************
*** 777,778 ****
--- 777,780 ----
  {   /* Add new patch number below this line */
+ /**/
+     1054,
  /**/

-- 
I'm writing a book.  I've got the page numbers done.

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