diff options
author | Siddharth Doshi <sdoshi@mvista.com> | 2023-01-03 11:14:27 +0530 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2023-01-19 07:49:31 -0500 |
commit | 10148c538ebcff5c12ea37aa38bcfe67305c2fc4 (patch) | |
tree | 02092c61b1ab67419ce532d094831e9f34d12e2b | |
parent | 6464eb9fc42ebc2a78c711c2ee91f77f8fbefb01 (diff) | |
download | meta-openembedded-10148c538ebcff5c12ea37aa38bcfe67305c2fc4.tar.gz |
xterm : Fix CVE-2022-45063 code execution via OSC 50 input sequences] CVE-2022-45063
Upstream-Status: Backport [https://github.com/ThomasDickey/xterm-snapshots/commit/787636674918873a091e7a4ef5977263ba982322]
CVE: CVE-2022-45063
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | meta-oe/recipes-graphics/xorg-app/xterm/CVE-2022-45063.patch | 785 | ||||
-rw-r--r-- | meta-oe/recipes-graphics/xorg-app/xterm_353.bb | 1 |
2 files changed, 786 insertions, 0 deletions
diff --git a/meta-oe/recipes-graphics/xorg-app/xterm/CVE-2022-45063.patch b/meta-oe/recipes-graphics/xorg-app/xterm/CVE-2022-45063.patch new file mode 100644 index 0000000000..8d1be32106 --- /dev/null +++ b/meta-oe/recipes-graphics/xorg-app/xterm/CVE-2022-45063.patch | |||
@@ -0,0 +1,785 @@ | |||
1 | From 787636674918873a091e7a4ef5977263ba982322 Mon Sep 17 00:00:00 2001 | ||
2 | From: "Thomas E. Dickey" <dickey@invisible-island.net> | ||
3 | Date: Sun, 23 Oct 2022 22:59:52 +0000 | ||
4 | Subject: [PATCH] snapshot of project "xterm", label xterm-374c | ||
5 | |||
6 | Upstream-Status: Backport [https://github.com/ThomasDickey/xterm-snapshots/commit/787636674918873a091e7a4ef5977263ba982322] | ||
7 | CVE: CVE-2022-45063 | ||
8 | |||
9 | Signed-off-by: Siddharth Doshi <sdoshi@mvista.com> | ||
10 | --- | ||
11 | button.c | 16 +-- | ||
12 | charproc.c | 9 +- | ||
13 | doublechr.c | 4 +- | ||
14 | fontutils.c | 266 ++++++++++++++++++++++++++----------------------- | ||
15 | fontutils.h | 4 +- | ||
16 | misc.c | 7 +- | ||
17 | screen.c | 2 +- | ||
18 | xterm.h | 2 +- | ||
19 | xterm.log.html | 6 ++ | ||
20 | 9 files changed, 164 insertions(+), 152 deletions(-) | ||
21 | |||
22 | diff --git a/button.c b/button.c | ||
23 | index 66a6181..e05ca50 100644 | ||
24 | --- a/button.c | ||
25 | +++ b/button.c | ||
26 | @@ -1619,14 +1619,9 @@ static void | ||
27 | UnmapSelections(XtermWidget xw) | ||
28 | { | ||
29 | TScreen *screen = TScreenOf(xw); | ||
30 | - Cardinal n; | ||
31 | |||
32 | - if (screen->mappedSelect) { | ||
33 | - for (n = 0; screen->mappedSelect[n] != 0; ++n) | ||
34 | - free((void *) screen->mappedSelect[n]); | ||
35 | - free(screen->mappedSelect); | ||
36 | - screen->mappedSelect = 0; | ||
37 | - } | ||
38 | + free(screen->mappedSelect); | ||
39 | + screen->mappedSelect = 0; | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | @@ -1662,14 +1657,11 @@ MapSelections(XtermWidget xw, String *params, Cardinal num_params) | ||
44 | if ((result = TypeMallocN(String, num_params + 1)) != 0) { | ||
45 | result[num_params] = 0; | ||
46 | for (j = 0; j < num_params; ++j) { | ||
47 | - result[j] = x_strdup((isSELECT(params[j]) | ||
48 | + result[j] = (String) (isSELECT(params[j]) | ||
49 | ? mapTo | ||
50 | - : params[j])); | ||
51 | + : params[j]); | ||
52 | if (result[j] == 0) { | ||
53 | UnmapSelections(xw); | ||
54 | - while (j != 0) { | ||
55 | - free((void *) result[--j]); | ||
56 | - } | ||
57 | free(result); | ||
58 | result = 0; | ||
59 | break; | ||
60 | diff --git a/charproc.c b/charproc.c | ||
61 | index 55f0108..b07de4c 100644 | ||
62 | --- a/charproc.c | ||
63 | +++ b/charproc.c | ||
64 | @@ -12548,7 +12548,6 @@ DoSetSelectedFont(Widget w, | ||
65 | Bell(xw, XkbBI_MinorError, 0); | ||
66 | } else { | ||
67 | Boolean failed = False; | ||
68 | - int oldFont = TScreenOf(xw)->menu_font_number; | ||
69 | char *save = TScreenOf(xw)->SelectFontName(); | ||
70 | char *val; | ||
71 | char *test; | ||
72 | @@ -12593,10 +12592,6 @@ DoSetSelectedFont(Widget w, | ||
73 | failed = True; | ||
74 | } | ||
75 | if (failed) { | ||
76 | - (void) xtermLoadFont(xw, | ||
77 | - xtermFontName(TScreenOf(xw)->MenuFontName(oldFont)), | ||
78 | - True, | ||
79 | - oldFont); | ||
80 | Bell(xw, XkbBI_MinorError, 0); | ||
81 | } | ||
82 | free(used); | ||
83 | @@ -12605,7 +12600,7 @@ DoSetSelectedFont(Widget w, | ||
84 | } | ||
85 | } | ||
86 | |||
87 | -void | ||
88 | +Bool | ||
89 | FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe) | ||
90 | { | ||
91 | TScreen *screen = TScreenOf(xw); | ||
92 | @@ -12645,7 +12640,7 @@ FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe) | ||
93 | DoSetSelectedFont, NULL, | ||
94 | XtLastTimestampProcessed(XtDisplay(xw))); | ||
95 | } | ||
96 | - return; | ||
97 | + return (screen->SelectFontName() != NULL) ? True : False; | ||
98 | } | ||
99 | |||
100 | Bool | ||
101 | diff --git a/doublechr.c b/doublechr.c | ||
102 | index a60f5bd..f7b6bae 100644 | ||
103 | --- a/doublechr.c | ||
104 | +++ b/doublechr.c | ||
105 | @@ -294,7 +294,7 @@ xterm_DoubleGC(XTermDraw * params, GC old_gc, int *inxp) | ||
106 | temp.flags = (params->attr_flags & BOLD); | ||
107 | temp.warn = fwResource; | ||
108 | |||
109 | - if (!xtermOpenFont(params->xw, name, &temp, False)) { | ||
110 | + if (!xtermOpenFont(params->xw, name, &temp, NULL, False)) { | ||
111 | XTermDraw local = *params; | ||
112 | char *nname; | ||
113 | |||
114 | @@ -303,7 +303,7 @@ xterm_DoubleGC(XTermDraw * params, GC old_gc, int *inxp) | ||
115 | nname = xtermSpecialFont(&local); | ||
116 | if (nname != 0) { | ||
117 | found = (Boolean) xtermOpenFont(params->xw, nname, &temp, | ||
118 | - False); | ||
119 | + NULL, False); | ||
120 | free(nname); | ||
121 | } | ||
122 | } else { | ||
123 | diff --git a/fontutils.c b/fontutils.c | ||
124 | index 4b0ef85..d9bfaf8 100644 | ||
125 | --- a/fontutils.c | ||
126 | +++ b/fontutils.c | ||
127 | @@ -92,9 +92,9 @@ | ||
128 | } | ||
129 | |||
130 | #define FREE_FNAME(field) \ | ||
131 | - if (fonts == 0 || myfonts.field != fonts->field) { \ | ||
132 | - FREE_STRING(myfonts.field); \ | ||
133 | - myfonts.field = 0; \ | ||
134 | + if (fonts == 0 || new_fnames.field != fonts->field) { \ | ||
135 | + FREE_STRING(new_fnames.field); \ | ||
136 | + new_fnames.field = 0; \ | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | @@ -573,7 +573,7 @@ open_italic_font(XtermWidget xw, int n, FontNameProperties *fp, XTermFonts * dat | ||
141 | if ((name = italic_font_name(fp, slant[pass])) != 0) { | ||
142 | TRACE(("open_italic_font %s %s\n", | ||
143 | whichFontEnum((VTFontEnum) n), name)); | ||
144 | - if (xtermOpenFont(xw, name, data, False)) { | ||
145 | + if (xtermOpenFont(xw, name, data, NULL, False)) { | ||
146 | result = (data->fs != 0); | ||
147 | #if OPT_REPORT_FONTS | ||
148 | if (resource.reportFonts) { | ||
149 | @@ -1006,13 +1006,14 @@ cannotFont(XtermWidget xw, const char *who, const char *tag, const char *name) | ||
150 | } | ||
151 | |||
152 | /* | ||
153 | - * Open the given font and verify that it is non-empty. Return a null on | ||
154 | + * Open the given font and verify that it is non-empty. Return false on | ||
155 | * failure. | ||
156 | */ | ||
157 | Bool | ||
158 | xtermOpenFont(XtermWidget xw, | ||
159 | const char *name, | ||
160 | XTermFonts * result, | ||
161 | + XTermFonts * current, | ||
162 | Bool force) | ||
163 | { | ||
164 | Bool code = False; | ||
165 | @@ -1020,7 +1021,12 @@ xtermOpenFont(XtermWidget xw, | ||
166 | |||
167 | TRACE(("xtermOpenFont %d:%d '%s'\n", | ||
168 | result->warn, xw->misc.fontWarnings, NonNull(name))); | ||
169 | + | ||
170 | if (!IsEmpty(name)) { | ||
171 | + Bool existing = (current != NULL | ||
172 | + && current->fs != NULL | ||
173 | + && current->fn != NULL); | ||
174 | + | ||
175 | if ((result->fs = XLoadQueryFont(screen->display, name)) != 0) { | ||
176 | code = True; | ||
177 | if (EmptyFont(result->fs)) { | ||
178 | @@ -1039,9 +1045,13 @@ xtermOpenFont(XtermWidget xw, | ||
179 | } else { | ||
180 | TRACE(("xtermOpenFont: cannot load font '%s'\n", name)); | ||
181 | } | ||
182 | - if (force) { | ||
183 | + if (existing) { | ||
184 | + TRACE(("...continue using font '%s'\n", current->fn)); | ||
185 | + result->fn = x_strdup(current->fn); | ||
186 | + result->fs = current->fs; | ||
187 | + } else if (force) { | ||
188 | NoFontWarning(result); | ||
189 | - code = xtermOpenFont(xw, DEFFONT, result, True); | ||
190 | + code = xtermOpenFont(xw, DEFFONT, result, NULL, True); | ||
191 | } | ||
192 | } | ||
193 | } | ||
194 | @@ -1289,6 +1299,7 @@ static Bool | ||
195 | loadNormFP(XtermWidget xw, | ||
196 | char **nameOutP, | ||
197 | XTermFonts * infoOut, | ||
198 | + XTermFonts * current, | ||
199 | int fontnum) | ||
200 | { | ||
201 | Bool status = True; | ||
202 | @@ -1298,7 +1309,7 @@ loadNormFP(XtermWidget xw, | ||
203 | if (!xtermOpenFont(xw, | ||
204 | *nameOutP, | ||
205 | infoOut, | ||
206 | - (fontnum == fontMenu_default))) { | ||
207 | + current, (fontnum == fontMenu_default))) { | ||
208 | /* | ||
209 | * If we are opening the default font, and it happens to be missing, | ||
210 | * force that to the compiled-in default font, e.g., "fixed". If we | ||
211 | @@ -1333,10 +1344,10 @@ loadBoldFP(XtermWidget xw, | ||
212 | if (fp != 0) { | ||
213 | NoFontWarning(infoOut); | ||
214 | *nameOutP = bold_font_name(fp, fp->average_width); | ||
215 | - if (!xtermOpenFont(xw, *nameOutP, infoOut, False)) { | ||
216 | + if (!xtermOpenFont(xw, *nameOutP, infoOut, NULL, False)) { | ||
217 | free(*nameOutP); | ||
218 | *nameOutP = bold_font_name(fp, -1); | ||
219 | - xtermOpenFont(xw, *nameOutP, infoOut, False); | ||
220 | + xtermOpenFont(xw, *nameOutP, infoOut, NULL, False); | ||
221 | } | ||
222 | TRACE(("...derived bold '%s'\n", NonNull(*nameOutP))); | ||
223 | } | ||
224 | @@ -1354,7 +1365,7 @@ loadBoldFP(XtermWidget xw, | ||
225 | TRACE(("...did not get a matching bold font\n")); | ||
226 | } | ||
227 | free(normal); | ||
228 | - } else if (!xtermOpenFont(xw, *nameOutP, infoOut, False)) { | ||
229 | + } else if (!xtermOpenFont(xw, *nameOutP, infoOut, NULL, False)) { | ||
230 | xtermCopyFontInfo(infoOut, infoRef); | ||
231 | TRACE(("...cannot load bold font '%s'\n", NonNull(*nameOutP))); | ||
232 | } else { | ||
233 | @@ -1408,7 +1419,7 @@ loadWideFP(XtermWidget xw, | ||
234 | } | ||
235 | |||
236 | if (check_fontname(*nameOutP)) { | ||
237 | - if (xtermOpenFont(xw, *nameOutP, infoOut, False) | ||
238 | + if (xtermOpenFont(xw, *nameOutP, infoOut, NULL, False) | ||
239 | && is_derived_font_name(*nameOutP) | ||
240 | && EmptyFont(infoOut->fs)) { | ||
241 | xtermCloseFont2(xw, infoOut - fWide, fWide); | ||
242 | @@ -1452,7 +1463,7 @@ loadWBoldFP(XtermWidget xw, | ||
243 | |||
244 | if (check_fontname(*nameOutP)) { | ||
245 | |||
246 | - if (xtermOpenFont(xw, *nameOutP, infoOut, False) | ||
247 | + if (xtermOpenFont(xw, *nameOutP, infoOut, NULL, False) | ||
248 | && is_derived_font_name(*nameOutP) | ||
249 | && !compatibleWideCounts(wideInfoRef->fs, infoOut->fs)) { | ||
250 | xtermCloseFont2(xw, infoOut - fWBold, fWBold); | ||
251 | @@ -1505,6 +1516,10 @@ loadWBoldFP(XtermWidget xw, | ||
252 | } | ||
253 | #endif | ||
254 | |||
255 | +/* | ||
256 | + * Load a given bitmap font, along with the bold/wide variants. | ||
257 | + * Returns nonzero on success. | ||
258 | + */ | ||
259 | int | ||
260 | xtermLoadFont(XtermWidget xw, | ||
261 | const VTFontNames * fonts, | ||
262 | @@ -1514,33 +1529,37 @@ xtermLoadFont(XtermWidget xw, | ||
263 | TScreen *screen = TScreenOf(xw); | ||
264 | VTwin *win = WhichVWin(screen); | ||
265 | |||
266 | - VTFontNames myfonts; | ||
267 | - XTermFonts fnts[fMAX]; | ||
268 | + VTFontNames new_fnames; | ||
269 | + XTermFonts new_fonts[fMAX]; | ||
270 | + XTermFonts old_fonts[fMAX]; | ||
271 | char *tmpname = NULL; | ||
272 | Boolean proportional = False; | ||
273 | + Boolean recovered; | ||
274 | + int code = 0; | ||
275 | |||
276 | - memset(&myfonts, 0, sizeof(myfonts)); | ||
277 | - memset(fnts, 0, sizeof(fnts)); | ||
278 | + memset(&new_fnames, 0, sizeof(new_fnames)); | ||
279 | + memset(new_fonts, 0, sizeof(new_fonts)); | ||
280 | + memcpy(&old_fonts, screen->fnts, sizeof(old_fonts)); | ||
281 | |||
282 | if (fonts != 0) | ||
283 | - myfonts = *fonts; | ||
284 | - if (!check_fontname(myfonts.f_n)) | ||
285 | - return 0; | ||
286 | + new_fnames = *fonts; | ||
287 | + if (!check_fontname(new_fnames.f_n)) | ||
288 | + return code; | ||
289 | |||
290 | if (fontnum == fontMenu_fontescape | ||
291 | - && myfonts.f_n != screen->MenuFontName(fontnum)) { | ||
292 | - if ((tmpname = x_strdup(myfonts.f_n)) == 0) | ||
293 | - return 0; | ||
294 | + && new_fnames.f_n != screen->MenuFontName(fontnum)) { | ||
295 | + if ((tmpname = x_strdup(new_fnames.f_n)) == 0) | ||
296 | + return code; | ||
297 | } | ||
298 | |||
299 | - TRACE(("Begin Cgs - xtermLoadFont(%s)\n", myfonts.f_n)); | ||
300 | + TRACE(("Begin Cgs - xtermLoadFont(%s)\n", new_fnames.f_n)); | ||
301 | releaseWindowGCs(xw, win); | ||
302 | |||
303 | #define DbgResource(name, field, index) \ | ||
304 | TRACE(("xtermLoadFont #%d "name" %s%s\n", \ | ||
305 | fontnum, \ | ||
306 | - (fnts[index].warn == fwResource) ? "*" : " ", \ | ||
307 | - NonNull(myfonts.field))) | ||
308 | + (new_fonts[index].warn == fwResource) ? "*" : " ", \ | ||
309 | + NonNull(new_fnames.field))) | ||
310 | DbgResource("normal", f_n, fNorm); | ||
311 | DbgResource("bold ", f_b, fBold); | ||
312 | #if OPT_WIDE_CHARS | ||
313 | @@ -1549,16 +1568,17 @@ xtermLoadFont(XtermWidget xw, | ||
314 | #endif | ||
315 | |||
316 | if (!loadNormFP(xw, | ||
317 | - &myfonts.f_n, | ||
318 | - &fnts[fNorm], | ||
319 | + &new_fnames.f_n, | ||
320 | + &new_fonts[fNorm], | ||
321 | + &old_fonts[fNorm], | ||
322 | fontnum)) | ||
323 | goto bad; | ||
324 | |||
325 | if (!loadBoldFP(xw, | ||
326 | - &myfonts.f_b, | ||
327 | - &fnts[fBold], | ||
328 | - myfonts.f_n, | ||
329 | - &fnts[fNorm], | ||
330 | + &new_fnames.f_b, | ||
331 | + &new_fonts[fBold], | ||
332 | + new_fnames.f_n, | ||
333 | + &new_fonts[fNorm], | ||
334 | fontnum)) | ||
335 | goto bad; | ||
336 | |||
337 | @@ -1570,20 +1590,20 @@ xtermLoadFont(XtermWidget xw, | ||
338 | if_OPT_WIDE_CHARS(screen, { | ||
339 | |||
340 | if (!loadWideFP(xw, | ||
341 | - &myfonts.f_w, | ||
342 | - &fnts[fWide], | ||
343 | - myfonts.f_n, | ||
344 | - &fnts[fNorm], | ||
345 | + &new_fnames.f_w, | ||
346 | + &new_fonts[fWide], | ||
347 | + new_fnames.f_n, | ||
348 | + &new_fonts[fNorm], | ||
349 | fontnum)) | ||
350 | goto bad; | ||
351 | |||
352 | if (!loadWBoldFP(xw, | ||
353 | - &myfonts.f_wb, | ||
354 | - &fnts[fWBold], | ||
355 | - myfonts.f_w, | ||
356 | - &fnts[fWide], | ||
357 | - myfonts.f_b, | ||
358 | - &fnts[fBold], | ||
359 | + &new_fnames.f_wb, | ||
360 | + &new_fonts[fWBold], | ||
361 | + new_fnames.f_w, | ||
362 | + &new_fonts[fWide], | ||
363 | + new_fnames.f_b, | ||
364 | + &new_fonts[fBold], | ||
365 | fontnum)) | ||
366 | goto bad; | ||
367 | |||
368 | @@ -1593,30 +1613,30 @@ xtermLoadFont(XtermWidget xw, | ||
369 | * Normal/bold fonts should be the same width. Also, the min/max | ||
370 | * values should be the same. | ||
371 | */ | ||
372 | - if (fnts[fNorm].fs != 0 | ||
373 | - && fnts[fBold].fs != 0 | ||
374 | - && (!is_fixed_font(fnts[fNorm].fs) | ||
375 | - || !is_fixed_font(fnts[fBold].fs) | ||
376 | - || differing_widths(fnts[fNorm].fs, fnts[fBold].fs))) { | ||
377 | + if (new_fonts[fNorm].fs != 0 | ||
378 | + && new_fonts[fBold].fs != 0 | ||
379 | + && (!is_fixed_font(new_fonts[fNorm].fs) | ||
380 | + || !is_fixed_font(new_fonts[fBold].fs) | ||
381 | + || differing_widths(new_fonts[fNorm].fs, new_fonts[fBold].fs))) { | ||
382 | TRACE(("Proportional font! normal %d/%d, bold %d/%d\n", | ||
383 | - fnts[fNorm].fs->min_bounds.width, | ||
384 | - fnts[fNorm].fs->max_bounds.width, | ||
385 | - fnts[fBold].fs->min_bounds.width, | ||
386 | - fnts[fBold].fs->max_bounds.width)); | ||
387 | + new_fonts[fNorm].fs->min_bounds.width, | ||
388 | + new_fonts[fNorm].fs->max_bounds.width, | ||
389 | + new_fonts[fBold].fs->min_bounds.width, | ||
390 | + new_fonts[fBold].fs->max_bounds.width)); | ||
391 | proportional = True; | ||
392 | } | ||
393 | |||
394 | if_OPT_WIDE_CHARS(screen, { | ||
395 | - if (fnts[fWide].fs != 0 | ||
396 | - && fnts[fWBold].fs != 0 | ||
397 | - && (!is_fixed_font(fnts[fWide].fs) | ||
398 | - || !is_fixed_font(fnts[fWBold].fs) | ||
399 | - || differing_widths(fnts[fWide].fs, fnts[fWBold].fs))) { | ||
400 | + if (new_fonts[fWide].fs != 0 | ||
401 | + && new_fonts[fWBold].fs != 0 | ||
402 | + && (!is_fixed_font(new_fonts[fWide].fs) | ||
403 | + || !is_fixed_font(new_fonts[fWBold].fs) | ||
404 | + || differing_widths(new_fonts[fWide].fs, new_fonts[fWBold].fs))) { | ||
405 | TRACE(("Proportional font! wide %d/%d, wide bold %d/%d\n", | ||
406 | - fnts[fWide].fs->min_bounds.width, | ||
407 | - fnts[fWide].fs->max_bounds.width, | ||
408 | - fnts[fWBold].fs->min_bounds.width, | ||
409 | - fnts[fWBold].fs->max_bounds.width)); | ||
410 | + new_fonts[fWide].fs->min_bounds.width, | ||
411 | + new_fonts[fWide].fs->max_bounds.width, | ||
412 | + new_fonts[fWBold].fs->min_bounds.width, | ||
413 | + new_fonts[fWBold].fs->max_bounds.width)); | ||
414 | proportional = True; | ||
415 | } | ||
416 | }); | ||
417 | @@ -1635,13 +1655,13 @@ xtermLoadFont(XtermWidget xw, | ||
418 | screen->ifnts_ok = False; | ||
419 | #endif | ||
420 | |||
421 | - xtermCopyFontInfo(GetNormalFont(screen, fNorm), &fnts[fNorm]); | ||
422 | - xtermCopyFontInfo(GetNormalFont(screen, fBold), &fnts[fBold]); | ||
423 | + xtermCopyFontInfo(GetNormalFont(screen, fNorm), &new_fonts[fNorm]); | ||
424 | + xtermCopyFontInfo(GetNormalFont(screen, fBold), &new_fonts[fBold]); | ||
425 | #if OPT_WIDE_CHARS | ||
426 | - xtermCopyFontInfo(GetNormalFont(screen, fWide), &fnts[fWide]); | ||
427 | - if (fnts[fWBold].fs == NULL) | ||
428 | - xtermCopyFontInfo(GetNormalFont(screen, fWide), &fnts[fWide]); | ||
429 | - xtermCopyFontInfo(GetNormalFont(screen, fWBold), &fnts[fWBold]); | ||
430 | + xtermCopyFontInfo(GetNormalFont(screen, fWide), &new_fonts[fWide]); | ||
431 | + if (new_fonts[fWBold].fs == NULL) | ||
432 | + xtermCopyFontInfo(GetNormalFont(screen, fWide), &new_fonts[fWide]); | ||
433 | + xtermCopyFontInfo(GetNormalFont(screen, fWBold), &new_fonts[fWBold]); | ||
434 | #endif | ||
435 | |||
436 | xtermUpdateFontGCs(xw, getNormalFont); | ||
437 | @@ -1672,7 +1692,7 @@ xtermLoadFont(XtermWidget xw, | ||
438 | unsigned ch; | ||
439 | |||
440 | #if OPT_TRACE | ||
441 | -#define TRACE_MISS(index) show_font_misses(#index, &fnts[index]) | ||
442 | +#define TRACE_MISS(index) show_font_misses(#index, &new_fonts[index]) | ||
443 | TRACE_MISS(fNorm); | ||
444 | TRACE_MISS(fBold); | ||
445 | #if OPT_WIDE_CHARS | ||
446 | @@ -1689,8 +1709,8 @@ xtermLoadFont(XtermWidget xw, | ||
447 | if ((n != UCS_REPL) | ||
448 | && (n != ch) | ||
449 | && (screen->fnt_boxes & 2)) { | ||
450 | - if (xtermMissingChar(n, &fnts[fNorm]) || | ||
451 | - xtermMissingChar(n, &fnts[fBold])) { | ||
452 | + if (xtermMissingChar(n, &new_fonts[fNorm]) || | ||
453 | + xtermMissingChar(n, &new_fonts[fBold])) { | ||
454 | UIntClr(screen->fnt_boxes, 2); | ||
455 | TRACE(("missing graphics character #%d, U+%04X\n", | ||
456 | ch, n)); | ||
457 | @@ -1702,12 +1722,12 @@ xtermLoadFont(XtermWidget xw, | ||
458 | #endif | ||
459 | |||
460 | for (ch = 1; ch < 32; ch++) { | ||
461 | - if (xtermMissingChar(ch, &fnts[fNorm])) { | ||
462 | + if (xtermMissingChar(ch, &new_fonts[fNorm])) { | ||
463 | TRACE(("missing normal char #%d\n", ch)); | ||
464 | UIntClr(screen->fnt_boxes, 1); | ||
465 | break; | ||
466 | } | ||
467 | - if (xtermMissingChar(ch, &fnts[fBold])) { | ||
468 | + if (xtermMissingChar(ch, &new_fonts[fBold])) { | ||
469 | TRACE(("missing bold char #%d\n", ch)); | ||
470 | UIntClr(screen->fnt_boxes, 1); | ||
471 | break; | ||
472 | @@ -1724,8 +1744,8 @@ xtermLoadFont(XtermWidget xw, | ||
473 | screen->enbolden = screen->bold_mode; | ||
474 | } else { | ||
475 | screen->enbolden = screen->bold_mode | ||
476 | - && ((fnts[fNorm].fs == fnts[fBold].fs) | ||
477 | - || same_font_name(myfonts.f_n, myfonts.f_b)); | ||
478 | + && ((new_fonts[fNorm].fs == new_fonts[fBold].fs) | ||
479 | + || same_font_name(new_fnames.f_n, new_fnames.f_b)); | ||
480 | } | ||
481 | TRACE(("Will %suse 1-pixel offset/overstrike to simulate bold\n", | ||
482 | screen->enbolden ? "" : "not ")); | ||
483 | @@ -1741,7 +1761,7 @@ xtermLoadFont(XtermWidget xw, | ||
484 | update_font_escape(); | ||
485 | } | ||
486 | #if OPT_SHIFT_FONTS | ||
487 | - screen->menu_font_sizes[fontnum] = FontSize(fnts[fNorm].fs); | ||
488 | + screen->menu_font_sizes[fontnum] = FontSize(new_fonts[fNorm].fs); | ||
489 | #endif | ||
490 | } | ||
491 | set_cursor_gcs(xw); | ||
492 | @@ -1756,20 +1776,21 @@ xtermLoadFont(XtermWidget xw, | ||
493 | FREE_FNAME(f_w); | ||
494 | FREE_FNAME(f_wb); | ||
495 | #endif | ||
496 | - if (fnts[fNorm].fn == fnts[fBold].fn) { | ||
497 | - free(fnts[fNorm].fn); | ||
498 | + if (new_fonts[fNorm].fn == new_fonts[fBold].fn) { | ||
499 | + free(new_fonts[fNorm].fn); | ||
500 | } else { | ||
501 | - free(fnts[fNorm].fn); | ||
502 | - free(fnts[fBold].fn); | ||
503 | + free(new_fonts[fNorm].fn); | ||
504 | + free(new_fonts[fBold].fn); | ||
505 | } | ||
506 | #if OPT_WIDE_CHARS | ||
507 | - free(fnts[fWide].fn); | ||
508 | - free(fnts[fWBold].fn); | ||
509 | + free(new_fonts[fWide].fn); | ||
510 | + free(new_fonts[fWBold].fn); | ||
511 | #endif | ||
512 | xtermSetWinSize(xw); | ||
513 | return 1; | ||
514 | |||
515 | bad: | ||
516 | + recovered = False; | ||
517 | if (tmpname) | ||
518 | free(tmpname); | ||
519 | |||
520 | @@ -1780,15 +1801,15 @@ xtermLoadFont(XtermWidget xw, | ||
521 | SetItemSensitivity(fontMenuEntries[fontnum].widget, True); | ||
522 | #endif | ||
523 | Bell(xw, XkbBI_MinorError, 0); | ||
524 | - myfonts.f_n = screen->MenuFontName(old_fontnum); | ||
525 | - return xtermLoadFont(xw, &myfonts, doresize, old_fontnum); | ||
526 | - } else if (x_strcasecmp(myfonts.f_n, DEFFONT)) { | ||
527 | - int code; | ||
528 | - | ||
529 | - myfonts.f_n = x_strdup(DEFFONT); | ||
530 | - TRACE(("...recovering for TrueType fonts\n")); | ||
531 | - code = xtermLoadFont(xw, &myfonts, doresize, fontnum); | ||
532 | - if (code) { | ||
533 | + new_fnames.f_n = screen->MenuFontName(old_fontnum); | ||
534 | + if (xtermLoadFont(xw, &new_fnames, doresize, old_fontnum)) | ||
535 | + recovered = True; | ||
536 | + } else if (x_strcasecmp(new_fnames.f_n, DEFFONT) | ||
537 | + && x_strcasecmp(new_fnames.f_n, old_fonts[fNorm].fn)) { | ||
538 | + new_fnames.f_n = x_strdup(old_fonts[fNorm].fn); | ||
539 | + TRACE(("...recovering from failed font-load\n")); | ||
540 | + if (xtermLoadFont(xw, &new_fnames, doresize, fontnum)) { | ||
541 | + recovered = True; | ||
542 | if (fontnum != fontMenu_fontsel) { | ||
543 | SetItemSensitivity(fontMenuEntries[fontnum].widget, | ||
544 | UsingRenderFont(xw)); | ||
545 | @@ -1797,15 +1818,15 @@ xtermLoadFont(XtermWidget xw, | ||
546 | FontHeight(screen), | ||
547 | FontWidth(screen))); | ||
548 | } | ||
549 | - return code; | ||
550 | } | ||
551 | #endif | ||
552 | - | ||
553 | - releaseWindowGCs(xw, win); | ||
554 | - | ||
555 | - xtermCloseFonts(xw, fnts); | ||
556 | - TRACE(("Fail Cgs - xtermLoadFont\n")); | ||
557 | - return 0; | ||
558 | + if (!recovered) { | ||
559 | + releaseWindowGCs(xw, win); | ||
560 | + xtermCloseFonts(xw, new_fonts); | ||
561 | + TRACE(("Fail Cgs - xtermLoadFont\n")); | ||
562 | + code = 0; | ||
563 | + } | ||
564 | + return code; | ||
565 | } | ||
566 | |||
567 | #if OPT_WIDE_ATTRS | ||
568 | @@ -1853,7 +1874,7 @@ xtermLoadItalics(XtermWidget xw) | ||
569 | } else { | ||
570 | xtermOpenFont(xw, | ||
571 | getNormalFont(screen, n)->fn, | ||
572 | - data, False); | ||
573 | + data, NULL, False); | ||
574 | } | ||
575 | } | ||
576 | } | ||
577 | @@ -4119,6 +4140,8 @@ findXftGlyph(XtermWidget xw, XftFont *given, unsigned wc) | ||
578 | } | ||
579 | #endif | ||
580 | if (foundXftGlyph(xw, check, wc)) { | ||
581 | + (void) added; | ||
582 | + (void) actual; | ||
583 | markXftOpened(xw, which, n, wc); | ||
584 | reportXftFonts(xw, check, "fallback", tag, myReport); | ||
585 | result = check; | ||
586 | @@ -4317,7 +4340,7 @@ lookupOneFontSize(XtermWidget xw, int fontnum) | ||
587 | |||
588 | memset(&fnt, 0, sizeof(fnt)); | ||
589 | screen->menu_font_sizes[fontnum] = -1; | ||
590 | - if (xtermOpenFont(xw, screen->MenuFontName(fontnum), &fnt, True)) { | ||
591 | + if (xtermOpenFont(xw, screen->MenuFontName(fontnum), &fnt, NULL, True)) { | ||
592 | if (fontnum <= fontMenu_lastBuiltin | ||
593 | || strcmp(fnt.fn, DEFFONT)) { | ||
594 | screen->menu_font_sizes[fontnum] = FontSize(fnt.fs); | ||
595 | @@ -4722,13 +4745,14 @@ HandleSetFont(Widget w GCC_UNUSED, | ||
596 | } | ||
597 | } | ||
598 | |||
599 | -void | ||
600 | +Bool | ||
601 | SetVTFont(XtermWidget xw, | ||
602 | int which, | ||
603 | Bool doresize, | ||
604 | const VTFontNames * fonts) | ||
605 | { | ||
606 | TScreen *screen = TScreenOf(xw); | ||
607 | + Bool result = False; | ||
608 | |||
609 | TRACE(("SetVTFont(which=%d, f_n=%s, f_b=%s)\n", which, | ||
610 | (fonts && fonts->f_n) ? fonts->f_n : "<null>", | ||
611 | @@ -4737,34 +4761,31 @@ SetVTFont(XtermWidget xw, | ||
612 | if (IsIcon(screen)) { | ||
613 | Bell(xw, XkbBI_MinorError, 0); | ||
614 | } else if (which >= 0 && which < NMENUFONTS) { | ||
615 | - VTFontNames myfonts; | ||
616 | + VTFontNames new_fnames; | ||
617 | |||
618 | - memset(&myfonts, 0, sizeof(myfonts)); | ||
619 | + memset(&new_fnames, 0, sizeof(new_fnames)); | ||
620 | if (fonts != 0) | ||
621 | - myfonts = *fonts; | ||
622 | + new_fnames = *fonts; | ||
623 | |||
624 | if (which == fontMenu_fontsel) { /* go get the selection */ | ||
625 | - FindFontSelection(xw, myfonts.f_n, False); | ||
626 | + result = FindFontSelection(xw, new_fnames.f_n, False); | ||
627 | } else { | ||
628 | - int oldFont = screen->menu_font_number; | ||
629 | - | ||
630 | #define USE_CACHED(field, name) \ | ||
631 | - if (myfonts.field == 0) { \ | ||
632 | - myfonts.field = x_strdup(screen->menu_font_names[which][name]); \ | ||
633 | - TRACE(("set myfonts." #field " from menu_font_names[%d][" #name "] %s\n", \ | ||
634 | - which, NonNull(myfonts.field))); \ | ||
635 | + if (new_fnames.field == NULL) { \ | ||
636 | + new_fnames.field = x_strdup(screen->menu_font_names[which][name]); \ | ||
637 | + TRACE(("set new_fnames." #field " from menu_font_names[%d][" #name "] %s\n", \ | ||
638 | + which, NonNull(new_fnames.field))); \ | ||
639 | } else { \ | ||
640 | - TRACE(("set myfonts." #field " reused\n")); \ | ||
641 | + TRACE(("set new_fnames." #field " reused\n")); \ | ||
642 | } | ||
643 | #define SAVE_FNAME(field, name) \ | ||
644 | - if (myfonts.field != 0) { \ | ||
645 | - if (screen->menu_font_names[which][name] == 0 \ | ||
646 | - || strcmp(screen->menu_font_names[which][name], myfonts.field)) { \ | ||
647 | - TRACE(("updating menu_font_names[%d][" #name "] to %s\n", \ | ||
648 | - which, myfonts.field)); \ | ||
649 | - FREE_STRING(screen->menu_font_names[which][name]); \ | ||
650 | - screen->menu_font_names[which][name] = x_strdup(myfonts.field); \ | ||
651 | - } \ | ||
652 | + if (new_fnames.field != NULL \ | ||
653 | + && (screen->menu_font_names[which][name] == NULL \ | ||
654 | + || strcmp(screen->menu_font_names[which][name], new_fnames.field))) { \ | ||
655 | + TRACE(("updating menu_font_names[%d][" #name "] to \"%s\"\n", \ | ||
656 | + which, new_fnames.field)); \ | ||
657 | + FREE_STRING(screen->menu_font_names[which][name]); \ | ||
658 | + screen->menu_font_names[which][name] = x_strdup(new_fnames.field); \ | ||
659 | } | ||
660 | |||
661 | USE_CACHED(f_n, fNorm); | ||
662 | @@ -4774,7 +4795,7 @@ SetVTFont(XtermWidget xw, | ||
663 | USE_CACHED(f_wb, fWBold); | ||
664 | #endif | ||
665 | if (xtermLoadFont(xw, | ||
666 | - &myfonts, | ||
667 | + &new_fnames, | ||
668 | doresize, which)) { | ||
669 | /* | ||
670 | * If successful, save the data so that a subsequent query via | ||
671 | @@ -4786,10 +4807,8 @@ SetVTFont(XtermWidget xw, | ||
672 | SAVE_FNAME(f_w, fWide); | ||
673 | SAVE_FNAME(f_wb, fWBold); | ||
674 | #endif | ||
675 | + result = True; | ||
676 | } else { | ||
677 | - (void) xtermLoadFont(xw, | ||
678 | - xtermFontName(screen->MenuFontName(oldFont)), | ||
679 | - doresize, oldFont); | ||
680 | Bell(xw, XkbBI_MinorError, 0); | ||
681 | } | ||
682 | FREE_FNAME(f_n); | ||
683 | @@ -4802,7 +4821,8 @@ SetVTFont(XtermWidget xw, | ||
684 | } else { | ||
685 | Bell(xw, XkbBI_MinorError, 0); | ||
686 | } | ||
687 | - return; | ||
688 | + TRACE(("...SetVTFont: %d\n", result)); | ||
689 | + return result; | ||
690 | } | ||
691 | |||
692 | #if OPT_RENDERFONT | ||
693 | diff --git a/fontutils.h b/fontutils.h | ||
694 | index 9d530c5..ceaf44a 100644 | ||
695 | --- a/fontutils.h | ||
696 | +++ b/fontutils.h | ||
697 | @@ -37,7 +37,7 @@ | ||
698 | /* *INDENT-OFF* */ | ||
699 | |||
700 | extern Bool xtermLoadDefaultFonts (XtermWidget /* xw */); | ||
701 | -extern Bool xtermOpenFont (XtermWidget /* xw */, const char */* name */, XTermFonts * /* result */, Bool /* force */); | ||
702 | +extern Bool xtermOpenFont (XtermWidget /* xw */, const char */* name */, XTermFonts * /* result */, XTermFonts * /* current */, Bool /* force */); | ||
703 | extern XTermFonts * getDoubleFont (TScreen * /* screen */, int /* which */); | ||
704 | extern XTermFonts * getItalicFont (TScreen * /* screen */, int /* which */); | ||
705 | extern XTermFonts * getNormalFont (TScreen * /* screen */, int /* which */); | ||
706 | @@ -50,7 +50,7 @@ extern int lookupRelativeFontSize (XtermWidget /* xw */, int /* old */, int /* r | ||
707 | extern int xtermGetFont (const char * /* param */); | ||
708 | extern int xtermLoadFont (XtermWidget /* xw */, const VTFontNames */* fonts */, Bool /* doresize */, int /* fontnum */); | ||
709 | extern void HandleSetFont PROTO_XT_ACTIONS_ARGS; | ||
710 | -extern void SetVTFont (XtermWidget /* xw */, int /* i */, Bool /* doresize */, const VTFontNames */* fonts */); | ||
711 | +extern Bool SetVTFont (XtermWidget /* xw */, int /* i */, Bool /* doresize */, const VTFontNames */* fonts */); | ||
712 | extern void allocFontList (XtermWidget /* xw */, const char * /* name */, XtermFontNames * /* target */, VTFontEnum /* which */, const char * /* source */, Bool /* ttf */); | ||
713 | extern void copyFontList (char *** /* targetp */, char ** /* source */); | ||
714 | extern void initFontLists (XtermWidget /* xw */); | ||
715 | diff --git a/misc.c b/misc.c | ||
716 | index cc323f8..6c5e938 100644 | ||
717 | --- a/misc.c | ||
718 | +++ b/misc.c | ||
719 | @@ -3787,9 +3787,9 @@ ChangeFontRequest(XtermWidget xw, String buf) | ||
720 | { | ||
721 | memset(&fonts, 0, sizeof(fonts)); | ||
722 | fonts.f_n = name; | ||
723 | - SetVTFont(xw, num, True, &fonts); | ||
724 | - if (num == screen->menu_font_number && | ||
725 | - num != fontMenu_fontescape) { | ||
726 | + if (SetVTFont(xw, num, True, &fonts) | ||
727 | + && num == screen->menu_font_number | ||
728 | + && num != fontMenu_fontescape) { | ||
729 | screen->EscapeFontName() = x_strdup(name); | ||
730 | } | ||
731 | } | ||
732 | @@ -6237,7 +6237,6 @@ xtermSetenv(const char *var, const char *value) | ||
733 | |||
734 | found = envindex; | ||
735 | environ[found + 1] = NULL; | ||
736 | - environ = environ; | ||
737 | } | ||
738 | |||
739 | environ[found] = TextAlloc(1 + len + strlen(value)); | ||
740 | diff --git a/screen.c b/screen.c | ||
741 | index 690e3e2..f84254f 100644 | ||
742 | --- a/screen.c | ||
743 | +++ b/screen.c | ||
744 | @@ -1497,7 +1497,7 @@ ScrnRefresh(XtermWidget xw, | ||
745 | screen->topline, toprow, leftcol, | ||
746 | nrows, ncols, | ||
747 | force ? " force" : "")); | ||
748 | - | ||
749 | + (void) recurse; | ||
750 | ++recurse; | ||
751 | |||
752 | if (screen->cursorp.col >= leftcol | ||
753 | diff --git a/xterm.h b/xterm.h | ||
754 | index ec70e43..aa71f96 100644 | ||
755 | --- a/xterm.h | ||
756 | +++ b/xterm.h | ||
757 | @@ -967,7 +967,7 @@ extern Bool CheckBufPtrs (TScreen * /* screen */); | ||
758 | extern Bool set_cursor_gcs (XtermWidget /* xw */); | ||
759 | extern char * vt100ResourceToString (XtermWidget /* xw */, const char * /* name */); | ||
760 | extern int VTInit (XtermWidget /* xw */); | ||
761 | -extern void FindFontSelection (XtermWidget /* xw */, const char * /* atom_name */, Bool /* justprobe */); | ||
762 | +extern Bool FindFontSelection (XtermWidget /* xw */, const char * /* atom_name */, Bool /* justprobe */); | ||
763 | extern void HideCursor (void); | ||
764 | extern void RestartBlinking(XtermWidget /* xw */); | ||
765 | extern void ShowCursor (void); | ||
766 | diff --git a/xterm.log.html b/xterm.log.html | ||
767 | index 47d590b..e27dc31 100644 | ||
768 | --- a/xterm.log.html | ||
769 | +++ b/xterm.log.html | ||
770 | @@ -991,6 +991,12 @@ | ||
771 | 2020/02/01</a></h1> | ||
772 | |||
773 | <ul> | ||
774 | + <li>improve error-recovery when setting a bitmap font for the | ||
775 | + VT100 window, e.g., in case <em>OSC 50</em> failed, | ||
776 | + restoring the most recent valid font so that a subsequent | ||
777 | + <em>OSC 50</em> reports this correctly (report by David | ||
778 | + Leadbeater).</li> | ||
779 | + | ||
780 | <li>amend change in <a href="#xterm_352">patch #352</a> for | ||
781 | button-events to fix a case where some followup events were not | ||
782 | processed soon enough (report/patch by Jimmy Aguilar | ||
783 | -- | ||
784 | 2.24.4 | ||
785 | |||
diff --git a/meta-oe/recipes-graphics/xorg-app/xterm_353.bb b/meta-oe/recipes-graphics/xorg-app/xterm_353.bb index 1862b250ef..4e2b0c9d53 100644 --- a/meta-oe/recipes-graphics/xorg-app/xterm_353.bb +++ b/meta-oe/recipes-graphics/xorg-app/xterm_353.bb | |||
@@ -8,6 +8,7 @@ SRC_URI = "http://invisible-mirror.net/archives/${BPN}/${BP}.tgz \ | |||
8 | file://0001-Add-configure-time-check-for-setsid.patch \ | 8 | file://0001-Add-configure-time-check-for-setsid.patch \ |
9 | file://CVE-2021-27135.patch \ | 9 | file://CVE-2021-27135.patch \ |
10 | file://CVE-2022-24130.patch \ | 10 | file://CVE-2022-24130.patch \ |
11 | file://CVE-2022-45063.patch \ | ||
11 | " | 12 | " |
12 | SRC_URI[md5sum] = "247c30ebfa44623f3a2d100e0cae5c7f" | 13 | SRC_URI[md5sum] = "247c30ebfa44623f3a2d100e0cae5c7f" |
13 | SRC_URI[sha256sum] = "e521d3ee9def61f5d5c911afc74dd5c3a56ce147c7071c74023ea24cac9bb768" | 14 | SRC_URI[sha256sum] = "e521d3ee9def61f5d5c911afc74dd5c3a56ce147c7071c74023ea24cac9bb768" |