Patch 8.1.0898
Problem:    A messed up rgb.txt can crash Vim. (Pavel Cheremushkin)
Solution:   Limit to 10000 entries.  Also don't retry many times when the file
            cannot be read.
Files:      src/term.c


*** ../vim-8.1.0897/src/term.c  2019-01-24 17:18:37.595462334 +0100
--- src/term.c  2019-02-12 20:41:40.212978067 +0100
***************
*** 6985,6997 ****
            return rgb_table[i].color;
  
      /*
!      * Last attempt. Look in the file "$VIM/rgb.txt".
       */
      if (size == 0)
      {
        int counting;
  
!       /* colornames_table not yet initialized */
        fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt");
        if (fname == NULL)
            return INVALCOLOR;
--- 6985,6997 ----
            return rgb_table[i].color;
  
      /*
!      * Last attempt. Look in the file "$VIMRUNTIME/rgb.txt".
       */
      if (size == 0)
      {
        int counting;
  
!       // colornames_table not yet initialized
        fname = expand_env_save((char_u *)"$VIMRUNTIME/rgb.txt");
        if (fname == NULL)
            return INVALCOLOR;
***************
*** 7002,7007 ****
--- 7002,7008 ----
        {
            if (p_verbose > 1)
                verb_msg(_("Cannot open $VIMRUNTIME/rgb.txt"));
+           size = -1;  // don't try again
            return INVALCOLOR;
        }
  
***************
*** 7050,7055 ****
--- 7051,7061 ----
                    colornames_table[size].color = (guicolor_T)RGB(r, g, b);
                }
                size++;
+ 
+               // The distributed rgb.txt has less than 1000 entries. Limit to
+               // 10000, just in case the file was messed up.
+               if (size == 10000)
+                   break;
            }
        }
        fclose(fd);
*** ../vim-8.1.0897/src/version.c       2019-02-11 22:00:07.671917613 +0100
--- src/version.c       2019-02-12 20:42:30.340701182 +0100
***************
*** 785,786 ****
--- 785,788 ----
  {   /* Add new patch number below this line */
+ /**/
+     898,
  /**/

-- 
God made machine language; all the rest is the work of man.

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