zsh-workers
 help / color / mirror / code / Atom feed
From: Geoff Wing <gcw@zsh.org>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: crashes when setting COLUMNS=0 or 1
Date: Tue, 26 Jun 2012 13:38:02 +1000	[thread overview]
Message-ID: <20120626033802.GA3066@primenet.com.au> (raw)
In-Reply-To: <BANLkTimx-EEcmUFcfiM0W2=kaPSoCK=RUg@mail.gmail.com>

On Thursday 2011-06-09 12:36 +0200, Mikael Magnusson output:
:To reproduce, run COLUMNS=0 and type two characters. This code in
:zle_refresh is where it crashes, it looks quite suspicious too.
:
:ZR_memset(p1 + nllen, zr_sp, winw - nllen);
:p1[winw] = zr_zr;
:if (nllen < winw)
:    p1[winw + 1] = zr_zr;
:else
:    p1[winw + 1] = nl[winw + 1];
:
:The code seems to expect nllen to possibly be larger than winw, yet it
:passes winw - nllen to memset as the length? (which is where it
:crashes).

I believe that it's checking if nllen equals winw (which is quite valid),
not that it is larger.  It's been a long time since I looked at this code.

:I can actually get a crash with a 1-char wide window too, by
:just resizing the terminal and typing some characters (This doesn't
:happen right away, needs to fiddle around for a bit, possibly ctrl-a
:and type some more). At first I thought it had to be doublewidth
:characters, but regular ones trigger it too.

Sounds like a different bug.

Old versions of Zsh never let COLUMNS be set to 0 or negative numbers.
It would retain its old value if you tried since it just doesn't make
sense.  This behaviour should be recovered.  Try 

% COLUMNS=-1; echo $COLUMNS
-1
%  (core dumped)

Regards,
Geoff


  reply	other threads:[~2012-06-26  3:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09 10:36 Mikael Magnusson
2012-06-26  3:38 ` Geoff Wing [this message]
2012-06-26  7:03   ` Bart Schaefer
2012-06-26  7:21     ` Bart Schaefer
2012-06-26  7:30     ` Bart Schaefer
2012-06-26  9:33       ` Peter Stephenson
2012-06-26 14:26         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120626033802.GA3066@primenet.com.au \
    --to=gcw@zsh.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).