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

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sat, 14 Jul 2018 12:15:57 +0200

On Fri, Jul 13, 2018 at 09:23:43PM -0400, Programmer wrote:
> The following diff corrects the flaws I've mentioned earlier with
> regards to ISO 8613-6 colors; to repeat, these flaws include not
> permitting colons to be used as seperators and incorrectly parsing RGB
> color parameters; only six lines are changed and changed very little at
> that, but I'll still release these six changed lines to the public
> domain, for simplicity:
>
> diff -c /home/programmer/st-0.8.1/st.c\~ /home/programmer/st-0.8.1/st.c
> *** /home/programmer/st-0.8.1/st.c~ Tue Mar 20 15:29:59 2018
> --- /home/programmer/st-0.8.1/st.c Fri Jul 13 19:32:43 2018
> ***************
> *** 1157,1163 ****
> v = -1;
> csiescseq.arg[csiescseq.narg++] = v;
> p = np;
> ! if (*p != ';' || csiescseq.narg == ESC_ARG_SIZ)
> break;
> p++;
> }
> --- 1157,1163 ----
> v = -1;
> csiescseq.arg[csiescseq.narg++] = v;
> p = np;
> ! if (*p != ';' || *p != ':' || csiescseq.narg == ESC_ARG_SIZ)
> break;
> p++;
> }
> ***************
> *** 1311,1326 ****
>
> switch (attr[*npar + 1]) {
> case 2: /* direct color in RGB space */
> ! if (*npar + 4 >= 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;
> 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);
> --- 1311,1326 ----
>
> switch (attr[*npar + 1]) {
> case 2: /* direct color in RGB space */
> ! if (*npar + 5 >= l) {
> fprintf(stderr,
> "erresc(38): Incorrect number of parameters (%d)\n",
> *npar);
> break;
> }
> ! 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);
>
> Diff finished. Fri Jul 13 19:33:32 2018
>


Hi,

Is this patch for upstream st?

Can you resend the patch in the proper format?
See "diff generation on the page": https://suckless.org/hacking/

Thanks,

-- 
Kind regards,
Hiltjo
Received on Sat Jul 14 2018 - 12:15:57 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 14 2018 - 12:24:07 CEST