]>
Commit | Line | Data |
---|---|---|
f3c378e8 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.0.134 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.0.134 | |
11 | Problem: Crash when comparing a recursively looped List or Dictionary. | |
12 | Solution: Limit recursiveness for comparing to 1000. | |
13 | Files: src/eval.c | |
14 | ||
15 | ||
16 | *** ../vim-7.0.133/src/eval.c Tue Oct 10 12:56:09 2006 | |
17 | --- src/eval.c Sun Oct 15 15:08:13 2006 | |
18 | *************** | |
19 | *** 5520,5538 **** | |
20 | { | |
21 | char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; | |
22 | char_u *s1, *s2; | |
23 | ||
24 | ! if (tv1->v_type != tv2->v_type) | |
25 | return FALSE; | |
26 | ||
27 | switch (tv1->v_type) | |
28 | { | |
29 | case VAR_LIST: | |
30 | ! /* recursive! */ | |
31 | ! return list_equal(tv1->vval.v_list, tv2->vval.v_list, ic); | |
32 | ||
33 | case VAR_DICT: | |
34 | ! /* recursive! */ | |
35 | ! return dict_equal(tv1->vval.v_dict, tv2->vval.v_dict, ic); | |
36 | ||
37 | case VAR_FUNC: | |
38 | return (tv1->vval.v_string != NULL | |
39 | --- 5520,5546 ---- | |
40 | { | |
41 | char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; | |
42 | char_u *s1, *s2; | |
43 | + static int recursive = 0; /* cach recursive loops */ | |
44 | + int r; | |
45 | ||
46 | ! /* Catch lists and dicts that have an endless loop by limiting | |
47 | ! * recursiveness to 1000. */ | |
48 | ! if (tv1->v_type != tv2->v_type || recursive >= 1000) | |
49 | return FALSE; | |
50 | ||
51 | switch (tv1->v_type) | |
52 | { | |
53 | case VAR_LIST: | |
54 | ! ++recursive; | |
55 | ! r = list_equal(tv1->vval.v_list, tv2->vval.v_list, ic); | |
56 | ! --recursive; | |
57 | ! return r; | |
58 | ||
59 | case VAR_DICT: | |
60 | ! ++recursive; | |
61 | ! r = dict_equal(tv1->vval.v_dict, tv2->vval.v_dict, ic); | |
62 | ! --recursive; | |
63 | ! return r; | |
64 | ||
65 | case VAR_FUNC: | |
66 | return (tv1->vval.v_string != NULL | |
67 | *** ../vim-7.0.133/src/version.c Sat Oct 14 14:33:21 2006 | |
68 | --- src/version.c Sun Oct 15 15:03:30 2006 | |
69 | *************** | |
70 | *** 668,669 **** | |
71 | --- 668,671 ---- | |
72 | { /* Add new patch number below this line */ | |
73 | + /**/ | |
74 | + 134, | |
75 | /**/ | |
76 | ||
77 | -- | |
78 | It was recently discovered that research causes cancer in rats. | |
79 | ||
80 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
81 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
82 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
83 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |