Patch 8.0.0526
Problem:    Coverity complains about possible negative value.
Solution:   Check return value of ftell() not to be negative.
Files:      src/os_unix.c


*** ../vim-8.0.0525/src/os_unix.c       2017-03-25 20:16:23.652639953 +0100
--- src/os_unix.c       2017-03-30 21:15:31.604133703 +0200
***************
*** 6006,6011 ****
--- 6006,6012 ----
  {
      int               i;
      size_t    len;
+     long      llen;
      char_u    *p;
      int               dir;
  
***************
*** 6292,6300 ****
        goto notfound;
      }
      fseek(fd, 0L, SEEK_END);
!     len = ftell(fd);                  /* get size of temp file */
      fseek(fd, 0L, SEEK_SET);
!     buffer = alloc(len + 1);
      if (buffer == NULL)
      {
        /* out of memory */
--- 6293,6305 ----
        goto notfound;
      }
      fseek(fd, 0L, SEEK_END);
!     llen = ftell(fd);                 /* get size of temp file */
      fseek(fd, 0L, SEEK_SET);
!     if (llen < 0)
!       /* just in case ftell() would fail */
!       buffer = NULL;
!     else
!       buffer = alloc(llen + 1);
      if (buffer == NULL)
      {
        /* out of memory */
***************
*** 6303,6308 ****
--- 6308,6314 ----
        fclose(fd);
        return FAIL;
      }
+     len = llen;
      i = fread((char *)buffer, 1, len, fd);
      fclose(fd);
      mch_remove(tempname);
*** ../vim-8.0.0525/src/version.c       2017-03-29 21:26:57.347685534 +0200
--- src/version.c       2017-03-30 21:12:17.449330352 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     526,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
237. You tattoo your email address on your forehead.

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui