This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
RE: [PATCH] Cygwin: pty: Fix ESC[?3h and ESC[?3l handling again.
- From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin-patches" <cygwin-patches at cygwin dot com>
- To: "cygwin-patches at cygwin dot com" <cygwin-patches at cygwin dot com>
- Date: Thu, 19 Dec 2019 15:50:07 +0000
- Subject: RE: [PATCH] Cygwin: pty: Fix ESC[?3h and ESC[?3l handling again.
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ncbi.nlm.nih.gov; dmarc=pass action=none header.from=ncbi.nlm.nih.gov; dkim=pass header.d=ncbi.nlm.nih.gov; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QxMSCD3wklNyyMHnOG7yINoXlz3roGXDKlixPRcaDU8=; b=eo6k7D852YLTtlKpVpwB1bJHyA0GGax99/aESy2yq8XYDiEaruOvKDU7jtnIHzc65ZrHJci9fDKqOFIjoFIfroyPEeKH/t52panZikFK7k92Izf5b2gOhP2cmopFCvKRBZXw9mpXoMUPGQxsye8gtSr/u0y8aA2ucCz5/wYqtFakprH1gQWiZXLkyC1AbCjnHweF3sA62W+OkHuL5OF7P6p7rhXVGx/a+Uik3aIhrMirD/ogBYrCK5rDUDLJqBf/0M2Ck9Nwm+/I9YyuG+q7ujaSH2HfRglsWYRu9ypSE1m0J1uLs57nmSBi7jChY5zqO0rnfrvmqntfbMViuZ8UXw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E+krRtS6GsKwGUX1DCbO6NuPJ7Ez/7FHop4Il5Fop6aA7itvRqFBqsN0xqUxmmEB31nt2+sp84kAT9yeRBY3+TtQlO/4azW39JNZxhjViKLmeTktTaN0S9zbU77AIr8qOdAphCK/Y/67RkWutiWgFlIPG/t3Osi9xN4gm0PllUMhm7Rr4jypDpEgcdV2anmF0cpZBJscnza4FbrgPMUCCV4z5TDbe/646y5YVjTE+qi2NxdYgHDIk+KqN83obnfHvsXB8Ews8xczBK+dXUEYXO+dI3M+jwjqLI4CoXoQG/DYfQ+PbCGXb4zw3+k3KMQoW1vCsROORQVgyUZ9GtlUNQ==
- Ironport-sdr: 35Z+l/5wQ5/owaSx2U5nsVsG+pOgxXoS7e44Gzg2lU2lxg9Qkm1ZYLTBVR28az7wz5WNKhWLOX 7dhA/pdSnTBA==
- References: <20191219110330.1902-1-takashi.yano@nifty.ne.jp> <20191219112924.GT10310@calimero.vinschen.de>
- Reply-to: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr at ncbi dot nlm dot nih dot gov>
Just noticed that in the patch below and couldn't help it, sorry..
Things like
char* p0;
and later:
isdigit(*p0)) or isalpha(*p0)
are usually not a good (correct) way of coding, because of possible sign extension of *p0
which you normally wouldn't want to have (remember the ctype calls/macros actually expect
an "int", not a character, input). So it should be either "unsigned char* p0" or
"isdigit((unsigned char)(*p0))", generally.
> -----Original Message-----
> From: cygwin-patches-owner@cygwin.com <cygwin-patches-owner@cygwin.com> On
> Behalf Of Corinna Vinschen
> Sent: Thursday, December 19, 2019 6:29 AM
> To: cygwin-patches@cygwin.com
> Subject: Re: [PATCH] Cygwin: pty: Fix ESC[?3h and ESC[?3l handling again.
>
> On Dec 19 20:03, Takashi Yano wrote:
> > - Even with commit fe512b2b12a2cea8393d14f038dc3914b1bf3f60, pty
> > still has a problem in ESC[?3h and ESC[?3l handling if invalid
> > sequence such as ESC[?$ is sent. This patch fixes the issue.
> > ---
> > winsup/cygwin/fhandler_tty.cc | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> > index 8c3a6e72e..f10f0fc61 100644
> > --- a/winsup/cygwin/fhandler_tty.cc
> > +++ b/winsup/cygwin/fhandler_tty.cc
> > @@ -1263,7 +1263,7 @@ fhandler_pty_slave::push_to_pcon_screenbuffer (const
> char *ptr, size_t len)
> > {
> > p0 += 3;
> > bool exist_arg_3 = false;
> > - while (p0 < buf + nlen && !isalpha (*p0))
> > + while (p0 < buf + nlen && (isdigit (*p0) || *p0 == ';'))
> > {
> > int arg = 0;
> > while (p0 < buf + nlen && isdigit (*p0))
> > --
> > 2.21.0
>
> Pushed.
>
>
> Thanks,
> Corinna
>
> --
> Corinna Vinschen
> Cygwin Maintainer