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
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.08
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.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 -- 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 ///
|