|
|
073263 |
To: vim_dev@googlegroups.com
|
|
|
073263 |
Subject: Patch 7.4.624
|
|
|
073263 |
Fcc: outbox
|
|
|
073263 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
073263 |
Mime-Version: 1.0
|
|
|
073263 |
Content-Type: text/plain; charset=UTF-8
|
|
|
073263 |
Content-Transfer-Encoding: 8bit
|
|
|
073263 |
------------
|
|
|
073263 |
|
|
|
073263 |
Patch 7.4.624
|
|
|
073263 |
Problem: May leak memory or crash when vim_realloc() returns NULL.
|
|
|
073263 |
Solution: Handle a NULL value properly. (Mike Williams)
|
|
|
073263 |
Files: src/if_cscope.c, src/memline.c, src/misc1.c, src/netbeans.c
|
|
|
073263 |
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.623/src/if_cscope.c 2014-12-13 03:20:10.539067382 +0100
|
|
|
073263 |
--- src/if_cscope.c 2015-02-10 18:33:14.764816257 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1507,1515 ****
|
|
|
073263 |
--- 1507,1522 ----
|
|
|
073263 |
}
|
|
|
073263 |
else
|
|
|
073263 |
{
|
|
|
073263 |
+ csinfo_T *t_csinfo = csinfo;
|
|
|
073263 |
+
|
|
|
073263 |
/* Reallocate space for more connections. */
|
|
|
073263 |
csinfo_size *= 2;
|
|
|
073263 |
csinfo = vim_realloc(csinfo, sizeof(csinfo_T)*csinfo_size);
|
|
|
073263 |
+ if (csinfo == NULL)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ vim_free(t_csinfo);
|
|
|
073263 |
+ csinfo_size = 0;
|
|
|
073263 |
+ }
|
|
|
073263 |
}
|
|
|
073263 |
if (csinfo == NULL)
|
|
|
073263 |
return -1;
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2059,2064 ****
|
|
|
073263 |
--- 2066,2072 ----
|
|
|
073263 |
int num_matches;
|
|
|
073263 |
{
|
|
|
073263 |
char *buf = NULL;
|
|
|
073263 |
+ char *t_buf;
|
|
|
073263 |
int bufsize = 0; /* Track available bufsize */
|
|
|
073263 |
int newsize = 0;
|
|
|
073263 |
char *ptag;
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2120,2128 ****
|
|
|
073263 |
--- 2128,2140 ----
|
|
|
073263 |
newsize = (int)(strlen(csfmt_str) + 16 + strlen(lno));
|
|
|
073263 |
if (bufsize < newsize)
|
|
|
073263 |
{
|
|
|
073263 |
+ t_buf = buf;
|
|
|
073263 |
buf = (char *)vim_realloc(buf, newsize);
|
|
|
073263 |
if (buf == NULL)
|
|
|
073263 |
+ {
|
|
|
073263 |
bufsize = 0;
|
|
|
073263 |
+ vim_free(t_buf);
|
|
|
073263 |
+ }
|
|
|
073263 |
else
|
|
|
073263 |
bufsize = newsize;
|
|
|
073263 |
}
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2143,2151 ****
|
|
|
073263 |
--- 2155,2167 ----
|
|
|
073263 |
|
|
|
073263 |
if (bufsize < newsize)
|
|
|
073263 |
{
|
|
|
073263 |
+ t_buf = buf;
|
|
|
073263 |
buf = (char *)vim_realloc(buf, newsize);
|
|
|
073263 |
if (buf == NULL)
|
|
|
073263 |
+ {
|
|
|
073263 |
bufsize = 0;
|
|
|
073263 |
+ vim_free(t_buf);
|
|
|
073263 |
+ }
|
|
|
073263 |
else
|
|
|
073263 |
bufsize = newsize;
|
|
|
073263 |
}
|
|
|
073263 |
*** ../vim-7.4.623/src/memline.c 2014-08-13 21:58:24.824885492 +0200
|
|
|
073263 |
--- src/memline.c 2015-02-10 18:26:23.158126542 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 5057,5062 ****
|
|
|
073263 |
--- 5057,5064 ----
|
|
|
073263 |
/* May resize here so we don't have to do it in both cases below */
|
|
|
073263 |
if (buf->b_ml.ml_usedchunks + 1 >= buf->b_ml.ml_numchunks)
|
|
|
073263 |
{
|
|
|
073263 |
+ chunksize_T *t_chunksize = buf->b_ml.ml_chunksize;
|
|
|
073263 |
+
|
|
|
073263 |
buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2;
|
|
|
073263 |
buf->b_ml.ml_chunksize = (chunksize_T *)
|
|
|
073263 |
vim_realloc(buf->b_ml.ml_chunksize,
|
|
|
073263 |
***************
|
|
|
073263 |
*** 5064,5069 ****
|
|
|
073263 |
--- 5066,5072 ----
|
|
|
073263 |
if (buf->b_ml.ml_chunksize == NULL)
|
|
|
073263 |
{
|
|
|
073263 |
/* Hmmmm, Give up on offset for this buffer */
|
|
|
073263 |
+ vim_free(t_chunksize);
|
|
|
073263 |
buf->b_ml.ml_usedchunks = -1;
|
|
|
073263 |
return;
|
|
|
073263 |
}
|
|
|
073263 |
*** ../vim-7.4.623/src/misc1.c 2014-08-29 12:58:38.246430208 +0200
|
|
|
073263 |
--- src/misc1.c 2015-02-10 18:26:35.405968505 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 3431,3440 ****
|
|
|
073263 |
--- 3431,3444 ----
|
|
|
073263 |
buf = alloc(buflen);
|
|
|
073263 |
else if (maxlen < 10)
|
|
|
073263 |
{
|
|
|
073263 |
+ char_u *t_buf = buf;
|
|
|
073263 |
+
|
|
|
073263 |
/* Need some more space. This might happen when receiving a long
|
|
|
073263 |
* escape sequence. */
|
|
|
073263 |
buflen += 100;
|
|
|
073263 |
buf = vim_realloc(buf, buflen);
|
|
|
073263 |
+ if (buf == NULL)
|
|
|
073263 |
+ vim_free(t_buf);
|
|
|
073263 |
maxlen = (buflen - 6 - len) / 3;
|
|
|
073263 |
}
|
|
|
073263 |
if (buf == NULL)
|
|
|
073263 |
*** ../vim-7.4.623/src/netbeans.c 2014-03-23 15:12:29.927264336 +0100
|
|
|
073263 |
--- src/netbeans.c 2015-02-10 18:27:18.693409965 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1080,1089 ****
|
|
|
073263 |
--- 1080,1097 ----
|
|
|
073263 |
{
|
|
|
073263 |
if (bufno >= buf_list_size) /* grow list */
|
|
|
073263 |
{
|
|
|
073263 |
+ nbbuf_T *t_buf_list = buf_list;
|
|
|
073263 |
+
|
|
|
073263 |
incr = bufno - buf_list_size + 90;
|
|
|
073263 |
buf_list_size += incr;
|
|
|
073263 |
buf_list = (nbbuf_T *)vim_realloc(
|
|
|
073263 |
buf_list, buf_list_size * sizeof(nbbuf_T));
|
|
|
073263 |
+ if (buf_list == NULL)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ vim_free(t_buf_list);
|
|
|
073263 |
+ buf_list_size = 0;
|
|
|
073263 |
+ return NULL;
|
|
|
073263 |
+ }
|
|
|
073263 |
vim_memset(buf_list + buf_list_size - incr, 0,
|
|
|
073263 |
incr * sizeof(nbbuf_T));
|
|
|
073263 |
}
|
|
|
073263 |
***************
|
|
|
073263 |
*** 3678,3688 ****
|
|
|
073263 |
--- 3686,3703 ----
|
|
|
073263 |
{
|
|
|
073263 |
int incr;
|
|
|
073263 |
int oldlen = globalsignmaplen;
|
|
|
073263 |
+ char **t_globalsignmap = globalsignmap;
|
|
|
073263 |
|
|
|
073263 |
globalsignmaplen *= 2;
|
|
|
073263 |
incr = globalsignmaplen - oldlen;
|
|
|
073263 |
globalsignmap = (char **)vim_realloc(globalsignmap,
|
|
|
073263 |
globalsignmaplen * sizeof(char *));
|
|
|
073263 |
+ if (globalsignmap == NULL)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ vim_free(t_globalsignmap);
|
|
|
073263 |
+ globalsignmaplen = 0;
|
|
|
073263 |
+ return;
|
|
|
073263 |
+ }
|
|
|
073263 |
vim_memset(globalsignmap + oldlen, 0, incr * sizeof(char *));
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
***************
|
|
|
073263 |
*** 3708,3718 ****
|
|
|
073263 |
--- 3723,3740 ----
|
|
|
073263 |
{
|
|
|
073263 |
int incr;
|
|
|
073263 |
int oldlen = buf->signmaplen;
|
|
|
073263 |
+ int *t_signmap = buf->signmap;
|
|
|
073263 |
|
|
|
073263 |
buf->signmaplen *= 2;
|
|
|
073263 |
incr = buf->signmaplen - oldlen;
|
|
|
073263 |
buf->signmap = (int *)vim_realloc(buf->signmap,
|
|
|
073263 |
buf->signmaplen * sizeof(int));
|
|
|
073263 |
+ if (buf->signmap == NULL)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ vim_free(t_signmap);
|
|
|
073263 |
+ buf->signmaplen = 0;
|
|
|
073263 |
+ return;
|
|
|
073263 |
+ }
|
|
|
073263 |
vim_memset(buf->signmap + oldlen, 0, incr * sizeof(int));
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
*** ../vim-7.4.623/src/version.c 2015-02-10 18:18:13.004452406 +0100
|
|
|
073263 |
--- src/version.c 2015-02-10 18:21:29.697913596 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 743,744 ****
|
|
|
073263 |
--- 743,746 ----
|
|
|
073263 |
{ /* Add new patch number below this line */
|
|
|
073263 |
+ /**/
|
|
|
073263 |
+ 624,
|
|
|
073263 |
/**/
|
|
|
073263 |
|
|
|
073263 |
--
|
|
|
073263 |
hundred-and-one symptoms of being an internet addict:
|
|
|
073263 |
211. Your husband leaves you...taking the computer with him and you
|
|
|
073263 |
call him crying, and beg him to bring the computer back.
|
|
|
073263 |
|
|
|
073263 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
073263 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
073263 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
073263 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|