[PATCH v2 1/4] Cygwin: console: Add workaround for broken IL/DL in xterm mode.

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Mar 2 19:54:00 GMT 2020


On Mar  2 18:03, Corinna Vinschen wrote:
> On Mar  1 15:38, Takashi Yano wrote:
> > Hi Hans,
> > 
> > On Sat, 29 Feb 2020 19:10:02 +0100
> > Hans-Bernhard Bröker wrote:
> > > One more important note: the current implementation has a potential 
> > > buffer overrun issue, because it writes first, and only then checks 
> > > whether that may have overrun the buffer.  And the check itself is off 
> > > by one, too:
> > > 
> > > >    wpbuf[wpixput++] = x; \
> > > >    if (wpixput > WPBUF_LEN) \
> > > >     wpixput--; \
> > > 
> > > That's why my latest code snippet does it differently:
> > > 
> > >  >      if (ixput < WPBUF_LEN)
> > >  >        {
> > >  >          buf[ixput++] = x;
> > >  >        }
> > 
> > Indeed. You are right. Thanks for pointing out that.
> > Another similar problem exists in console code of escape
> > sequence handling, so I will submit a patch for that.
> > 
> > As for wpbuf, please continue to fix.
> 
> Yeah, a patch in `git format-patch' format would be most welcome.
> 
> For a first-time contribution (and then never again) we also need
> a 2-clause BSD license waiver per https://cygwin.com/contrib.html

I pushed wpbuf_put as a simple inline function as a stop-gap
measure so Cygwin builds on gcc 9.2.0.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20200302/3c1fb947/attachment.sig>


More information about the Cygwin-patches mailing list