Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xterm merge xterm-366. this includes the fix...



details:   https://anonhg.NetBSD.org/xsrc/rev/8f371a63be95
branches:  trunk
changeset: 10647:8f371a63be95
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Feb 11 12:24:39 2021 +0000

description:
merge xterm-366.  this includes the fix for CVE-2021-27135.

(note that testing so far has not revealed this problem on netbsd,
though i have not heard about pkgsrc x11 users.)

diffstat:

 external/mit/xterm/dist/XTerm.ad      |    15 +-
 external/mit/xterm/dist/fontutils.c   |  1980 ++++++++++++++++++----
 external/mit/xterm/dist/linedata.c    |   139 +-
 external/mit/xterm/dist/misc.c        |  2411 +++++++++++++++++++++-------
 external/mit/xterm/dist/ptyx.h        |   799 +++++++--
 external/mit/xterm/dist/scrollback.c  |    12 +-
 external/mit/xterm/dist/xterm.h       |   341 +++-
 external/mit/xterm/dist/xterm.man     |  2801 ++++++++++++++++++++++----------
 external/mit/xterm/include/xtermcfg.h |    55 +-
 9 files changed, 6285 insertions(+), 2268 deletions(-)

diffs (truncated from 14881 to 300 lines):

diff -r b6c5874fd0b2 -r 8f371a63be95 external/mit/xterm/dist/XTerm.ad
--- a/external/mit/xterm/dist/XTerm.ad  Thu Feb 11 12:19:54 2021 +0000
+++ b/external/mit/xterm/dist/XTerm.ad  Thu Feb 11 12:24:39 2021 +0000
@@ -1,8 +1,8 @@
-! $XTermId: XTerm.ad,v 1.102 2016/12/22 02:07:39 tom Exp $
+! $XTermId: XTerm.ad,v 1.106 2021/02/03 01:02:03 tom Exp $
 ! -----------------------------------------------------------------------------
 ! this file is part of xterm
 !
-! Copyright 1996-2011,2016 by Thomas E. Dickey
+! Copyright 1996-2020,2021 by Thomas E. Dickey
 ! 
 !                         All Rights Reserved
 ! 
@@ -87,6 +87,7 @@
 *vtMenu*scrollttyoutput*Label:  Scroll to Bottom on Tty Output
 *vtMenu*allow132*Label: Allow 80/132 Column Switching
 *vtMenu*keepSelection*Label: Keep Selection
+*vtMenu*keepClipboard*Label: Keep Clipboard
 *vtMenu*selectToClipboard*Label: Select to Clipboard
 *vtMenu*cursesemul*Label:  Enable Curses Emulation
 *vtMenu*visualbell*Label:  Enable Visual Bell
@@ -120,6 +121,9 @@
 *VT100.font5:          9x15
 *fontMenu*font6*Label: Huge
 *VT100.font6:          10x20
+*fontMenu*font7*Label: Enormous
+!*VT100.font7:         12x24
+*VT100.font7:          -adobe-courier-medium-r-normal--24-240-75-75-m-150-iso10646-1
 *fontMenu*fontescape*Label:    Escape Sequence
 *fontMenu*fontsel*Label:       Selection
 !fontescape and fontsel overridden by application
@@ -147,6 +151,13 @@
 *VT100.utf8Fonts.font5:        -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
 *VT100.utf8Fonts.font6:        -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1
 
+! The default fixed font and font2-font6 are commonly aliased to iso106461 (Unicode)
+! with XXX glyphs, but 12x24 is usually just iso8859-1 (about 200 glyphs).
+! The adobe-courier is more commonly available than the b&h font.
+!*VT100.utf8Fonts.font7: -sony-fixed-medium-r-normal--24-170-100-100-c-120-iso8859-1
+*VT100.utf8Fonts.font7: -adobe-courier-medium-r-normal--24-240-75-75-m-150-iso10646-1
+!*VT100.utf8Fonts.font7: -b&h-lucidatypewriter-medium-r-normal-sans-24-240-75-75-m-140-iso10646-1
+
 *tekMenu.Label:  Tek Options
 *tekMenu*tektextlarge*Label:  Large Characters
 *tekMenu*tektext2*Label:  #2 Size Characters
diff -r b6c5874fd0b2 -r 8f371a63be95 external/mit/xterm/dist/fontutils.c
--- a/external/mit/xterm/dist/fontutils.c       Thu Feb 11 12:19:54 2021 +0000
+++ b/external/mit/xterm/dist/fontutils.c       Thu Feb 11 12:24:39 2021 +0000
@@ -1,7 +1,7 @@
-/* $XTermId: fontutils.c,v 1.531 2017/06/20 09:10:19 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.701 2021/02/02 00:40:30 tom Exp $ */
 
 /*
- * Copyright 1998-2016,2017 by Thomas E. Dickey
+ * Copyright 1998-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -51,8 +51,10 @@
 #include <stdio.h>
 #include <ctype.h>
 
+#define NoFontWarning(data) (data)->warn = fwAlways
+
 #define SetFontWidth(screen,dst,src)  (dst)->f_width = (src)
-#define SetFontHeight(screen,dst,src) (dst)->f_height = dimRound((screen)->scale_height * (float) (src))
+#define SetFontHeight(screen,dst,src) (dst)->f_height = dimRound((double)((screen)->scale_height * (float) (src)))
 
 /* from X11/Xlibint.h - not all vendors install this file */
 #define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
@@ -120,6 +122,32 @@
     char *end;
 } FontNameProperties;
 
+#if OPT_WIDE_CHARS && (OPT_RENDERFONT || (OPT_TRACE > 1))
+#define MY_UCS(code,high,wide,name) { code, high, wide, #name }
+static const struct {
+    unsigned code, high, wide;
+    const char *name;
+} unicode_boxes[] = {
+
+    MY_UCS(0x2500, 0, 1, box drawings light horizontal),
+       MY_UCS(0x2502, 1, 0, box drawings light vertical),
+       MY_UCS(0x250c, 2, 2, box drawings light down and right),
+       MY_UCS(0x2510, 2, 2, box drawings light down and left),
+       MY_UCS(0x2514, 2, 2, box drawings light up and right),
+       MY_UCS(0x2518, 2, 2, box drawings light up and left),
+       MY_UCS(0x251c, 1, 2, box drawings light vertical and right),
+       MY_UCS(0x2524, 1, 2, box drawings light vertical and left),
+       MY_UCS(0x252c, 2, 1, box drawings light down and horizontal),
+       MY_UCS(0x2534, 2, 1, box drawings light up and horizontal),
+       MY_UCS(0x253c, 1, 1, box drawings light vertical and horizontal),
+    {
+       0, 0, 0, NULL
+    }
+};
+
+#undef MY_UCS
+#endif /* OPT_WIDE_CHARS */
+
 #if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS
 static Boolean merge_sublist(char ***, char **);
 #endif
@@ -135,6 +163,27 @@
 static int lookupOneFontSize(XtermWidget, int);
 #endif
 
+#if OPT_TRACE
+static void
+set_font_height(TScreen *screen, VTwin *win, int height)
+{
+    SetFontHeight(screen, win, height);
+    TRACE(("SetFontHeight %d\n", win->f_height));
+#undef SetFontHeight
+#define SetFontHeight(screen, win, height) set_font_height(screen, win, height)
+}
+
+static void
+set_font_width(TScreen *screen, VTwin *win, int width)
+{
+    (void) screen;
+    SetFontWidth(screen, win, width);
+    TRACE(("SetFontWidth  %d\n", win->f_width));
+#undef  SetFontWidth
+#define SetFontWidth(screen, win, height) set_font_width(screen, win, height)
+}
+#endif
+
 #if OPT_REPORT_FONTS || OPT_WIDE_CHARS
 static unsigned
 countGlyphs(XFontStruct *fp)
@@ -206,6 +255,40 @@
 }
 #endif
 
+typedef struct _nameList {
+    struct _nameList *next;
+    char *name;
+} NameList;
+
+static NameList *derived_fonts;
+
+static Boolean
+is_derived_font_name(const char *name)
+{
+    Boolean result = False;
+    NameList *list;
+    if (!IsEmpty(name)) {
+       for (list = derived_fonts; list != 0; list = list->next) {
+           if (!x_strcasecmp(name, list->name)) {
+               result = True;
+               break;
+           }
+       }
+    }
+    return result;
+}
+
+void
+xtermDerivedFont(const char *name)
+{
+    if (!IsEmpty(name) && !is_derived_font_name(name)) {
+       NameList *list = TypeCalloc(NameList);
+       list->name = x_strdup(name);
+       list->next = derived_fonts;
+       derived_fonts = list;
+    }
+}
+
 /*
  * Returns the fields from start to stop in a dash- separated string.  This
  * function will modify the source, putting '\0's in the appropriate place and
@@ -273,13 +356,18 @@
     static FontNameProperties props;
     static char *last_name;
 
-    Atom fontatom = XInternAtom(dpy, "FONT", False);
-    char *name = 0;
+    Atom fontatom;
+    char *name;
     char *str;
 
+    if (fs == NULL)
+       return NULL;
+
     /*
      * first get the full font name
      */
+    name = 0;
+    fontatom = XInternAtom(dpy, "FONT", False);
     if (fontatom != 0) {
        XFontProp *fp;
        int i;
@@ -298,15 +386,13 @@
     /*
      * XGetAtomName allocates memory - don't leak
      */
-    if (last_name != 0)
-       XFree(last_name);
+    XFree(last_name);
     last_name = name;
 
     if (result != 0) {
        if (!check_fontname(name))
            return 0;
-       if (*result != 0)
-           free(*result);
+       free(*result);
        *result = x_strdup(name);
     }
 
@@ -449,6 +535,7 @@
     append_fontname_num(&result, use_average_width);
     append_fontname_str(&result, use_encoding);
 
+    xtermDerivedFont(result);
     return result;
 }
 
@@ -475,11 +562,12 @@
        "o",
        "i"
     };
-    char *name;
     Cardinal pass;
     Boolean result = False;
 
+    NoFontWarning(data);
     for (pass = 0; pass < XtNumber(slant); ++pass) {
+       char *name;
        if ((name = italic_font_name(fp, slant[pass])) != 0) {
            TRACE(("open_italic_font %s %s\n",
                   whichFontEnum((VTFontEnum) n), name));
@@ -488,7 +576,7 @@
 #if OPT_REPORT_FONTS
                if (resource.reportFonts) {
                    printf("opened italic version of %s:\n\t%s\n",
-                          whichFontEnum(n),
+                          whichFontEnum((VTFontEnum) n),
                           name);
                }
 #endif
@@ -541,9 +629,9 @@
  * fonts we double the pixel-size and Y-resolution
  */
 char *
-xtermSpecialFont(XtermWidget xw, unsigned attr_flags, unsigned draw_flags, unsigned chrset)
+xtermSpecialFont(XTermDraw * params)
 {
-    TScreen *screen = TScreenOf(xw);
+    TScreen *screen = TScreenOf(params->xw);
 #if OPT_TRACE
     static char old_spacing[80];
     static FontNameProperties old_props;
@@ -556,23 +644,23 @@
     int res_y;
 
     props = get_font_name_props(screen->display,
-                               getNormalFont(screen, fNorm)->fs, 0);
+                               GetNormalFont(screen, fNorm)->fs, 0);
     if (props == 0)
        return result;
 
     pixel_size = props->pixel_size;
     res_x = props->res_x;
     res_y = props->res_y;
-    if (attr_flags & BOLD)
+    if (params->attr_flags & BOLD)
        weight = "bold";
     else
        weight = props->weight;
 
-    if (CSET_DOUBLE(chrset))
+    if (CSET_DOUBLE(params->this_chrset))
        res_x *= 2;
 
-    if (chrset == CSET_DHL_TOP
-       || chrset == CSET_DHL_BOT) {
+    if (params->this_chrset == CSET_DHL_TOP
+       || params->this_chrset == CSET_DHL_BOT) {
        res_y *= 2;
        pixel_size *= 2;
     }
@@ -582,7 +670,7 @@
        || old_props.pixel_size != pixel_size
        || strcmp(old_props.spacing, props->spacing)) {
        TRACE(("xtermSpecialFont(atts = %#x, draw = %#x, chrset = %#x)\n",
-              attr_flags, draw_flags, chrset));
+              params->attr_flags, params->draw_flags, params->this_chrset));
        TRACE(("res_x      = %d\n", res_x));
        TRACE(("res_y      = %d\n", res_y));
        TRACE(("point_size = %s\n", props->point_size));
@@ -603,12 +691,13 @@
     append_fontname_str(&result, props->add_style);
     append_fontname_num(&result, pixel_size);
     append_fontname_str(&result, props->point_size);
-    append_fontname_num(&result, (draw_flags & NORESOLUTION) ? -1 : res_x);
-    append_fontname_num(&result, (draw_flags & NORESOLUTION) ? -1 : res_y);
+    append_fontname_num(&result, (params->draw_flags & NORESOLUTION) ? -1 : res_x);



Home | Main Index | Thread Index | Old Index