Re: [dev] [st] Two flaws with ISO 8613-6 colors, proper

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Thu, 26 Jul 2018 09:31:39 +0200

On Wed, Jul 25, 2018 at 03:10:28PM -0400, Programmer wrote:
> Follows is the proper form of the st patch submitted earlier,
> st-fix_8613_colors-0.8.1.diff:
>
> diff -up st-0.8.1/st.c st-0.8.1-changed/st.c
> --- st-0.8.1/st.c Tue Mar 20 15:29:59 2018
> +++ st-0.8.1-changed/st.c Wed Jul 25 13:55:16 2018
> _AT_@ -1157,7 +1157,7 @@ csiparse(void)
> v = -1;
> csiescseq.arg[csiescseq.narg++] = v;
> p = np;
> - if (*p != ';' || csiescseq.narg == ESC_ARG_SIZ)
> + if (*p != ';' || *p != ':' || csiescseq.narg == ESC_ARG_SIZ)
> break;
> p++;
> }
> _AT_@ -1311,16 +1311,16 @@ tdefcolor(int *attr, int *npar, int l)
>
> switch (attr[*npar + 1]) {
> case 2: /* direct color in RGB space */
> - if (*npar + 4 >= l) {
> + if (*npar + 5 >= l) {
> fprintf(stderr,
> "erresc(38): Incorrect number of parameters (%d)\n",
> *npar);
> break;
> }
> - r = attr[*npar + 2];
> - g = attr[*npar + 3];
> - b = attr[*npar + 4];
> - *npar += 4;
> + r = attr[*npar + 3];
> + g = attr[*npar + 4];
> + b = attr[*npar + 5];
> + *npar += 5;
> if (!BETWEEN(r, 0, 255) || !BETWEEN(g, 0, 255) || !BETWEEN(b, 0, 255))
> fprintf(stderr, "erresc: bad rgb color (%u,%u,%u)\n",
> r, g, b);
>

Thanks for the patch and detailed info in the previous mail.

I'm curious, is there a specific program you use where this bug is noticable?

I'll look at the patch at a later date.

-- 
Kind regards,
Hiltjo
Received on Thu Jul 26 2018 - 09:31:39 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 26 2018 - 09:36:08 CEST