1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

Fix crash on ESC#6 + combining chars + GTK + odd-width terminal.

When we're displaying double-width text as a result of the VT100 ESC#6
escape sequence or its friends, and the terminal width is an odd
number of columns, we divide by 2 the number of characters we'll even
try to display, and round _down_: if there's a rightmost odd column,
it stays blank, and doesn't show the left half of a double-width char.

In the GTK redraw function, that rounding-down can set the 'len'
variable to zero. But when we're displaying a character with Unicode
combining chars on top, that fails an assertion that len == 1, because
at the top of the function we set it to 1.

The fix is just to return early if len is reduced to zero by that
rounding: if we're not displaying any characters, then we don't have
to do anything at all.
This commit is contained in:
Simon Tatham 2019-02-14 18:05:22 +00:00
parent 3edc1b330d
commit daf91ef8ae

View File

@ -3769,8 +3769,11 @@ static void do_text_internal(
x *= 2; x *= 2;
if (x >= inst->term->cols) if (x >= inst->term->cols)
return; return;
if (x + len*2*widefactor > inst->term->cols) if (x + len*2*widefactor > inst->term->cols) {
len = (inst->term->cols-x)/2/widefactor;/* trim to LH half */ len = (inst->term->cols-x)/2/widefactor;/* trim to LH half */
if (len == 0)
return; /* rounded down half a double-width char to zero */
}
rlen = len * 2; rlen = len * 2;
} else } else
rlen = len; rlen = len;