diff options
author | saloni <saloni.jain@kpit.com> | 2021-02-05 21:12:34 +0530 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-02-06 09:03:00 +0000 |
commit | b74de5d19ae33dcfd5d1aabbe3ff4c5bd2900ac3 (patch) | |
tree | c044aa9d19e31e45c9b04737fccfc56f6ba38a92 | |
parent | 51b95cf1e7e613043795b564311971450b14fd8e (diff) | |
download | poky-b74de5d19ae33dcfd5d1aabbe3ff4c5bd2900ac3.tar.gz |
libcroco: Added CVE
Added below CVE:
CVE-2020-12825
Link: CVE-2020-12825 [https://gitlab.gnome.org/Archive/libcroco/-/commit/6eb257e5c731c691eb137fca94e916ca73941a5a]
Link: https://gitlab.gnome.org/Archive/libcroco/-/issues/8
(From OE-Core rev: f8cee7386c556e1c5adb07a0aee385642b7a5568)
Signed-off-by: Saloni Jain <Saloni.Jain@kpit.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-support/libcroco/files/CVE-2020-12825.patch | 192 | ||||
-rw-r--r-- | meta/recipes-support/libcroco/libcroco_0.6.13.bb | 3 |
2 files changed, 195 insertions, 0 deletions
diff --git a/meta/recipes-support/libcroco/files/CVE-2020-12825.patch b/meta/recipes-support/libcroco/files/CVE-2020-12825.patch new file mode 100644 index 0000000000..42f92e3607 --- /dev/null +++ b/meta/recipes-support/libcroco/files/CVE-2020-12825.patch | |||
@@ -0,0 +1,192 @@ | |||
1 | From fdf78a4877afa987ba646a8779b513f258e6d04c Mon Sep 17 00:00:00 2001 | ||
2 | From: Michael Catanzaro <mcatanzaro@gnome.org> | ||
3 | Date: Fri, 31 Jul 2020 15:21:53 -0500 | ||
4 | Subject: [PATCH] libcroco: Limit recursion in block and any productions | ||
5 | |||
6 | (CVE-2020-12825) | ||
7 | |||
8 | If we don't have any limits, we can recurse forever and overflow the | ||
9 | stack. | ||
10 | |||
11 | Fixes #8 | ||
12 | This is per https://gitlab.gnome.org/Archive/libcroco/-/issues/8 | ||
13 | |||
14 | https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1404 | ||
15 | |||
16 | CVE: CVE-2020-12825 | ||
17 | Upstream-Status: Backport [https://gitlab.gnome.org/Archive/libcroco/-/commit/6eb257e5c731c691eb137fca94e916ca73941a5a] | ||
18 | Comment: No refreshing changes done. | ||
19 | Signed-off-by: Saloni Jain <Saloni.Jain@kpit.com> | ||
20 | |||
21 | --- | ||
22 | src/cr-parser.c | 44 +++++++++++++++++++++++++++++--------------- | ||
23 | 1 file changed, 29 insertions(+), 15 deletions(-) | ||
24 | |||
25 | diff --git a/src/cr-parser.c b/src/cr-parser.c | ||
26 | index 18c9a01..f4a62e3 100644 | ||
27 | --- a/src/cr-parser.c | ||
28 | +++ b/src/cr-parser.c | ||
29 | @@ -136,6 +136,8 @@ struct _CRParserPriv { | ||
30 | |||
31 | #define CHARS_TAB_SIZE 12 | ||
32 | |||
33 | +#define RECURSIVE_CALLERS_LIMIT 100 | ||
34 | + | ||
35 | /** | ||
36 | * IS_NUM: | ||
37 | *@a_char: the char to test. | ||
38 | @@ -344,9 +346,11 @@ static enum CRStatus cr_parser_parse_selector_core (CRParser * a_this); | ||
39 | |||
40 | static enum CRStatus cr_parser_parse_declaration_core (CRParser * a_this); | ||
41 | |||
42 | -static enum CRStatus cr_parser_parse_any_core (CRParser * a_this); | ||
43 | +static enum CRStatus cr_parser_parse_any_core (CRParser * a_this, | ||
44 | + guint n_calls); | ||
45 | |||
46 | -static enum CRStatus cr_parser_parse_block_core (CRParser * a_this); | ||
47 | +static enum CRStatus cr_parser_parse_block_core (CRParser * a_this, | ||
48 | + guint n_calls); | ||
49 | |||
50 | static enum CRStatus cr_parser_parse_value_core (CRParser * a_this); | ||
51 | |||
52 | @@ -784,7 +788,7 @@ cr_parser_parse_atrule_core (CRParser * a_this) | ||
53 | cr_parser_try_to_skip_spaces_and_comments (a_this); | ||
54 | |||
55 | do { | ||
56 | - status = cr_parser_parse_any_core (a_this); | ||
57 | + status = cr_parser_parse_any_core (a_this, 0); | ||
58 | } while (status == CR_OK); | ||
59 | |||
60 | status = cr_tknzr_get_next_token (PRIVATE (a_this)->tknzr, | ||
61 | @@ -795,7 +799,7 @@ cr_parser_parse_atrule_core (CRParser * a_this) | ||
62 | cr_tknzr_unget_token (PRIVATE (a_this)->tknzr, | ||
63 | token); | ||
64 | token = NULL; | ||
65 | - status = cr_parser_parse_block_core (a_this); | ||
66 | + status = cr_parser_parse_block_core (a_this, 0); | ||
67 | CHECK_PARSING_STATUS (status, | ||
68 | FALSE); | ||
69 | goto done; | ||
70 | @@ -930,11 +934,11 @@ cr_parser_parse_selector_core (CRParser * a_this) | ||
71 | |||
72 | RECORD_INITIAL_POS (a_this, &init_pos); | ||
73 | |||
74 | - status = cr_parser_parse_any_core (a_this); | ||
75 | + status = cr_parser_parse_any_core (a_this, 0); | ||
76 | CHECK_PARSING_STATUS (status, FALSE); | ||
77 | |||
78 | do { | ||
79 | - status = cr_parser_parse_any_core (a_this); | ||
80 | + status = cr_parser_parse_any_core (a_this, 0); | ||
81 | |||
82 | } while (status == CR_OK); | ||
83 | |||
84 | @@ -956,10 +960,12 @@ cr_parser_parse_selector_core (CRParser * a_this) | ||
85 | *in chapter 4.1 of the css2 spec. | ||
86 | *block ::= '{' S* [ any | block | ATKEYWORD S* | ';' ]* '}' S*; | ||
87 | *@param a_this the current instance of #CRParser. | ||
88 | + *@param n_calls used to limit recursion depth | ||
89 | *FIXME: code this function. | ||
90 | */ | ||
91 | static enum CRStatus | ||
92 | -cr_parser_parse_block_core (CRParser * a_this) | ||
93 | +cr_parser_parse_block_core (CRParser * a_this, | ||
94 | + guint n_calls) | ||
95 | { | ||
96 | CRToken *token = NULL; | ||
97 | CRInputPos init_pos; | ||
98 | @@ -967,6 +973,9 @@ cr_parser_parse_block_core (CRParser * a_this) | ||
99 | |||
100 | g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR); | ||
101 | |||
102 | + if (n_calls > RECURSIVE_CALLERS_LIMIT) | ||
103 | + return CR_ERROR; | ||
104 | + | ||
105 | RECORD_INITIAL_POS (a_this, &init_pos); | ||
106 | |||
107 | status = cr_tknzr_get_next_token (PRIVATE (a_this)->tknzr, &token); | ||
108 | @@ -996,13 +1005,13 @@ cr_parser_parse_block_core (CRParser * a_this) | ||
109 | } else if (token->type == CBO_TK) { | ||
110 | cr_tknzr_unget_token (PRIVATE (a_this)->tknzr, token); | ||
111 | token = NULL; | ||
112 | - status = cr_parser_parse_block_core (a_this); | ||
113 | + status = cr_parser_parse_block_core (a_this, n_calls + 1); | ||
114 | CHECK_PARSING_STATUS (status, FALSE); | ||
115 | goto parse_block_content; | ||
116 | } else { | ||
117 | cr_tknzr_unget_token (PRIVATE (a_this)->tknzr, token); | ||
118 | token = NULL; | ||
119 | - status = cr_parser_parse_any_core (a_this); | ||
120 | + status = cr_parser_parse_any_core (a_this, n_calls + 1); | ||
121 | CHECK_PARSING_STATUS (status, FALSE); | ||
122 | goto parse_block_content; | ||
123 | } | ||
124 | @@ -1109,7 +1118,7 @@ cr_parser_parse_value_core (CRParser * a_this) | ||
125 | status = cr_tknzr_unget_token (PRIVATE (a_this)->tknzr, | ||
126 | token); | ||
127 | token = NULL; | ||
128 | - status = cr_parser_parse_block_core (a_this); | ||
129 | + status = cr_parser_parse_block_core (a_this, 0); | ||
130 | CHECK_PARSING_STATUS (status, FALSE); | ||
131 | ref++; | ||
132 | goto continue_parsing; | ||
133 | @@ -1123,7 +1132,7 @@ cr_parser_parse_value_core (CRParser * a_this) | ||
134 | status = cr_tknzr_unget_token (PRIVATE (a_this)->tknzr, | ||
135 | token); | ||
136 | token = NULL; | ||
137 | - status = cr_parser_parse_any_core (a_this); | ||
138 | + status = cr_parser_parse_any_core (a_this, 0); | ||
139 | if (status == CR_OK) { | ||
140 | ref++; | ||
141 | goto continue_parsing; | ||
142 | @@ -1162,10 +1171,12 @@ cr_parser_parse_value_core (CRParser * a_this) | ||
143 | * | FUNCTION | DASHMATCH | '(' any* ')' | '[' any* ']' ] S*; | ||
144 | * | ||
145 | *@param a_this the current instance of #CRParser. | ||
146 | + *@param n_calls used to limit recursion depth | ||
147 | *@return CR_OK upon successfull completion, an error code otherwise. | ||
148 | */ | ||
149 | static enum CRStatus | ||
150 | -cr_parser_parse_any_core (CRParser * a_this) | ||
151 | +cr_parser_parse_any_core (CRParser * a_this, | ||
152 | + guint n_calls) | ||
153 | { | ||
154 | CRToken *token1 = NULL, | ||
155 | *token2 = NULL; | ||
156 | @@ -1174,6 +1185,9 @@ cr_parser_parse_any_core (CRParser * a_this) | ||
157 | |||
158 | g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR); | ||
159 | |||
160 | + if (n_calls > RECURSIVE_CALLERS_LIMIT) | ||
161 | + return CR_ERROR; | ||
162 | + | ||
163 | RECORD_INITIAL_POS (a_this, &init_pos); | ||
164 | |||
165 | status = cr_tknzr_get_next_token (PRIVATE (a_this)->tknzr, &token1); | ||
166 | @@ -1212,7 +1226,7 @@ cr_parser_parse_any_core (CRParser * a_this) | ||
167 | *We consider parameter as being an "any*" production. | ||
168 | */ | ||
169 | do { | ||
170 | - status = cr_parser_parse_any_core (a_this); | ||
171 | + status = cr_parser_parse_any_core (a_this, n_calls + 1); | ||
172 | } while (status == CR_OK); | ||
173 | |||
174 | ENSURE_PARSING_COND (status == CR_PARSING_ERROR); | ||
175 | @@ -1237,7 +1251,7 @@ cr_parser_parse_any_core (CRParser * a_this) | ||
176 | } | ||
177 | |||
178 | do { | ||
179 | - status = cr_parser_parse_any_core (a_this); | ||
180 | + status = cr_parser_parse_any_core (a_this, n_calls + 1); | ||
181 | } while (status == CR_OK); | ||
182 | |||
183 | ENSURE_PARSING_COND (status == CR_PARSING_ERROR); | ||
184 | @@ -1265,7 +1279,7 @@ cr_parser_parse_any_core (CRParser * a_this) | ||
185 | } | ||
186 | |||
187 | do { | ||
188 | - status = cr_parser_parse_any_core (a_this); | ||
189 | + status = cr_parser_parse_any_core (a_this, n_calls + 1); | ||
190 | } while (status == CR_OK); | ||
191 | |||
192 | ENSURE_PARSING_COND (status == CR_PARSING_ERROR); | ||
diff --git a/meta/recipes-support/libcroco/libcroco_0.6.13.bb b/meta/recipes-support/libcroco/libcroco_0.6.13.bb index 9171a9de5c..a443ff23fe 100644 --- a/meta/recipes-support/libcroco/libcroco_0.6.13.bb +++ b/meta/recipes-support/libcroco/libcroco_0.6.13.bb | |||
@@ -18,3 +18,6 @@ inherit gnomebase gtk-doc binconfig-disabled | |||
18 | 18 | ||
19 | SRC_URI[archive.md5sum] = "c80c5a8385011a0260dce6bd0da93dce" | 19 | SRC_URI[archive.md5sum] = "c80c5a8385011a0260dce6bd0da93dce" |
20 | SRC_URI[archive.sha256sum] = "767ec234ae7aa684695b3a735548224888132e063f92db585759b422570621d4" | 20 | SRC_URI[archive.sha256sum] = "767ec234ae7aa684695b3a735548224888132e063f92db585759b422570621d4" |
21 | |||
22 | SRC_URI +="file://CVE-2020-12825.patch \ | ||
23 | " | ||