This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] Cygwin: pty: Fix ESC[?3h and ESC[?3l handling again.


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]