Re: [hackers] [st][PATCH] Follow text color only if exists

From: Jules Maselbas <jules.maselbas_AT_grenoble-inp.org>
Date: Sat, 14 Jul 2018 23:21:46 +0200 (CEST)

Hi,

> Fix crash when text color is not set and is out of bound.
> ---
> x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/x.c b/x.c
> index b51821d..4b7ffe6 100644
> --- a/x.c
> +++ b/x.c
> _AT_@ -1425,7 +1425,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph
> og)
>
> if (g.mode & ATTR_BOLD && BETWEEN(g.fg, 0, 7))
> drawcol = dc.col[g.fg + 8];
> - else
> + else if (g.fg < LEN(dc.col))
Can you explain how this can happen, I thought that g.fg cannot be above 255.

> drawcol = dc.col[g.fg];
> }
>
> --
> 2.18.0
Received on Sat Jul 14 2018 - 23:21:46 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 14 2018 - 23:24:20 CEST