1 https://salsa.debian.org/debian/screen/-/raw/debian/4.8.0-5/debian/patches/99_CVE-2021-26937.patch
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
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));
20 static int recode_char_dw __P((int, int *, int, int));
21 static int recode_char_dw_to_encoding __P((int, int *, int));
26 + if (c >= 0xdf00 && c <= 0xdfff)
27 + return 1; /* dw combining sequence */
28 return ((bisearch(c, wide, sizeof(wide) / sizeof(struct interval) - 1)) ||
30 bisearch(c, ambiguous,
31 @@ -1330,11 +1332,12 @@
35 -comb_tofront(root, i)
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;
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)
56 /* completely full, can't recycle */
57 debug("utf8_handle_comp: completely full!\n");
59 mc->font = (i >> 8) + 0xd8;
61 debug3("combinig char %x %x -> %x\n", c1, c, i + 0xd800);
62 - comb_tofront(root, i);