gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / screen-CVE-2021-26937.patch
1 https://salsa.debian.org/debian/screen/-/raw/debian/4.8.0-5/debian/patches/99_CVE-2021-26937.patch
2
3 Description: [CVE-2021-26937] Fix out of bounds array access
4 Author: Michael Schröder <mls@suse.de>
5 Bug-Debian: https://bugs.debian.org/982435
6 Bug: https://savannah.gnu.org/bugs/?60030
7 Bug: https://lists.gnu.org/archive/html/screen-devel/2021-02/msg00000.html
8 Bug-OSS-Security: https://www.openwall.com/lists/oss-security/2021/02/09/3
9 Origin: https://lists.gnu.org/archive/html/screen-devel/2021-02/msg00010.html
10
11 --- a/encoding.c
12 +++ b/encoding.c
13 @@ -43,7 +43,7 @@
14 # ifdef UTF8
15 static int recode_char __P((int, int, int));
16 static int recode_char_to_encoding __P((int, int));
17 -static void comb_tofront __P((int, int));
18 +static void comb_tofront __P((int));
19 # ifdef DW_CHARS
20 static int recode_char_dw __P((int, int *, int, int));
21 static int recode_char_dw_to_encoding __P((int, int *, int));
22 @@ -1263,6 +1263,8 @@
23 {0x30000, 0x3FFFD},
24 };
25
26 + if (c >= 0xdf00 && c <= 0xdfff)
27 + return 1; /* dw combining sequence */
28 return ((bisearch(c, wide, sizeof(wide) / sizeof(struct interval) - 1)) ||
29 (cjkwidth &&
30 bisearch(c, ambiguous,
31 @@ -1330,11 +1332,12 @@
32 }
33
34 static void
35 -comb_tofront(root, i)
36 -int root, i;
37 +comb_tofront(i)
38 +int i;
39 {
40 for (;;)
41 {
42 + int root = i >= 0x700 ? 0x801 : 0x800;
43 debug1("bring to front: %x\n", i);
44 combchars[combchars[i]->prev]->next = combchars[i]->next;
45 combchars[combchars[i]->next]->prev = combchars[i]->prev;
46 @@ -1396,9 +1399,9 @@
47 {
48 /* full, recycle old entry */
49 if (c1 >= 0xd800 && c1 < 0xe000)
50 - comb_tofront(root, c1 - 0xd800);
51 + comb_tofront(c1 - 0xd800);
52 i = combchars[root]->prev;
53 - if (c1 == i + 0xd800)
54 + if (i == 0x800 || i == 0x801 || c1 == i + 0xd800)
55 {
56 /* completely full, can't recycle */
57 debug("utf8_handle_comp: completely full!\n");
58 @@ -1422,7 +1425,7 @@
59 mc->font = (i >> 8) + 0xd8;
60 mc->fontx = 0;
61 debug3("combinig char %x %x -> %x\n", c1, c, i + 0xd800);
62 - comb_tofront(root, i);
63 + comb_tofront(i);
64 }
65
66 #else /* !UTF8 */