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

[Git][xorg-team/app/xterm][debian-buster] Cherry-pick sixel graphics fixes from xterm 370d and 370f



Title: GitLab

Sven Joachim pushed to branch debian-buster at X Strike Force / app / xterm

Commits:

3 changed files:

Changes:

  • debian/changelog
    1
    +xterm (344-1+deb10u2) UNRELEASED; urgency=medium
    
    2
    +
    
    3
    +  * Cherry-pick sixel graphics fixes from xterm 370d and 370f.
    
    4
    +    - Check for out-of-bounds condition while drawing sixels, and quit
    
    5
    +      that operation (report by Nick Black (CVE-2022-24130),
    
    6
    +      Closes: #1004689).
    
    7
    +
    
    8
    + -- Sven Joachim <svenjoac@gmx.de>  Wed, 02 Feb 2022 20:08:03 +0100
    
    9
    +
    
    1 10
     xterm (344-1+deb10u1) buster; urgency=medium
    
    2 11
     
    
    3 12
       * Apply upstream fix from xterm 366 for CVE-2021-27135.
    

  • debian/patches/CVE-2022-24130.diff
    1
    +Description: Cherry-pick sixel graphics fixes from xterm 370d and 370f
    
    2
    + Check for out-of-bounds condition while drawing sixels, and quit that
    
    3
    + operation (report by Nick Black, CVE-2022-24130).
    
    4
    +Bug-Debian: https://bugs.debian.org/1004689
    
    5
    +
    
    6
    +---
    
    7
    + graphics_sixel.c |   31 +++++++++++++++++++++++++------
    
    8
    + 1 file changed, 25 insertions(+), 6 deletions(-)
    
    9
    +
    
    10
    +--- a/graphics_sixel.c
    
    11
    ++++ b/graphics_sixel.c
    
    12
    +@@ -141,7 +141,7 @@ init_sixel_background(Graphic *graphic,
    
    13
    +     graphic->color_registers_used[context->background] = 1;
    
    14
    + }
    
    15
    + 
    
    16
    +-static void
    
    17
    ++static Boolean
    
    18
    + set_sixel(Graphic *graphic, SixelContext const *context, int sixel)
    
    19
    + {
    
    20
    +     const int mh = graphic->max_height;
    
    21
    +@@ -162,7 +162,10 @@ set_sixel(Graphic *graphic, SixelContext
    
    22
    + 	   ((color != COLOR_HOLE)
    
    23
    + 	    ? (unsigned) graphic->color_registers[color].b : 0U)));
    
    24
    +     for (pix = 0; pix < 6; pix++) {
    
    25
    +-	if (context->col < mw && context->row + pix < mh) {
    
    26
    ++	if (context->col >= 0 &&
    
    27
    ++	    context->col < mw &&
    
    28
    ++	    context->row + pix >= 0 &&
    
    29
    ++	    context->row + pix < mh) {
    
    30
    + 	    if (sixel & (1 << pix)) {
    
    31
    + 		if (context->col + 1 > graphic->actual_width) {
    
    32
    + 		    graphic->actual_width = context->col + 1;
    
    33
    +@@ -175,8 +178,10 @@ set_sixel(Graphic *graphic, SixelContext
    
    34
    + 	    }
    
    35
    + 	} else {
    
    36
    + 	    TRACE(("sixel pixel %d out of bounds\n", pix));
    
    37
    ++	    return False;
    
    38
    + 	}
    
    39
    +     }
    
    40
    ++    return True;
    
    41
    + }
    
    42
    + 
    
    43
    + static void
    
    44
    +@@ -451,7 +456,12 @@ parse_sixel(XtermWidget xw, ANSI *params
    
    45
    + 		init_sixel_background(graphic, &context);
    
    46
    + 		graphic->valid = 1;
    
    47
    + 	    }
    
    48
    +-	    set_sixel(graphic, &context, sixel);
    
    49
    ++	    if (sixel) {
    
    50
    ++		if (!set_sixel(graphic, &context, sixel)) {
    
    51
    ++		    context.col = 0;
    
    52
    ++		    break;
    
    53
    ++		}
    
    54
    ++	    }
    
    55
    + 	    context.col++;
    
    56
    + 	} else if (ch == '$') {	/* DECGCR */
    
    57
    + 	    /* ignore DECCRNLM in sixel mode */
    
    58
    +@@ -528,9 +538,18 @@ parse_sixel(XtermWidget xw, ANSI *params
    
    59
    + 		init_sixel_background(graphic, &context);
    
    60
    + 		graphic->valid = 1;
    
    61
    + 	    }
    
    62
    +-	    for (i = 0; i < Pcount; i++) {
    
    63
    +-		set_sixel(graphic, &context, sixel);
    
    64
    +-		context.col++;
    
    65
    ++	    if (sixel) {
    
    66
    ++		int i;
    
    67
    ++		for (i = 0; i < Pcount; i++) {
    
    68
    ++		    if (set_sixel(graphic, &context, sixel)) {
    
    69
    ++			context.col++;
    
    70
    ++		    } else {
    
    71
    ++			context.col = 0;
    
    72
    ++			break;
    
    73
    ++		    }
    
    74
    ++		}
    
    75
    ++	    } else {
    
    76
    ++		context.col += Pcount;
    
    77
    + 	    }
    
    78
    + 	} else if (ch == '#') {	/* DECGCI */
    
    79
    + 	    ANSI color_params;

  • debian/patches/series
    ... ... @@ -2,3 +2,4 @@
    2 2
     902_windowops.diff
    
    3 3
     904_fontops.diff
    
    4 4
     CVE-2021-27135.diff
    
    5
    +CVE-2022-24130.diff


  • Reply to: