From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20645 invoked from network); 8 Jan 2008 15:04:31 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 8 Jan 2008 15:04:31 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 86528 invoked from network); 8 Jan 2008 15:04:25 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 8 Jan 2008 15:04:25 -0000 Received: (qmail 418 invoked by alias); 8 Jan 2008 15:04:22 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24371 Received: (qmail 406 invoked from network); 8 Jan 2008 15:04:21 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 8 Jan 2008 15:04:21 -0000 Received: from virusfilter.dotsrc.org (bifrost [127.0.0.1]) by spamfilter.dotsrc.org (Postfix) with ESMTP id 14EF58058FF2 for ; Tue, 8 Jan 2008 16:04:18 +0100 (CET) Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [85.115.41.190]) by bifrost.dotsrc.org (Postfix) with ESMTP for ; Tue, 8 Jan 2008 16:04:17 +0100 (CET) Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly13g.srv.mailcontrol.com (MailControl) with ESMTP id m08ExY1G015779 for ; Tue, 8 Jan 2008 15:04:12 GMT Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Tue, 8 Jan 2008 15:02:35 +0000 Date: Tue, 8 Jan 2008 15:02:35 +0000 From: Peter Stephenson To: "Zsh Hackers' List" Subject: Re: Segmentation fault while searching backward Message-ID: <20080108150235.7c7335b1@news01> In-Reply-To: References: Organization: CSR X-Mailer: Claws Mail 3.2.0 (GTK+ 2.10.14; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 08 Jan 2008 15:02:35.0685 (UTC) FILETIME=[80A8BD50:01C85207] X-Scanned-By: MailControl A-06-00-00 (www.mailcontrol.com) on 10.71.0.123 X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 19 Dec 2007 00:59:34 +0000 (UTC) J=C3=B6rg Sommer wrote: > when I search backward through the history with ^R I get a segmentation > fault: J=C3=B6rg sent me his history and I can get it to crash, although not quite= as straightforwardly (it needed some scrolling). The crash I was getting was in a large chunk of history that needed scrolling to handle. I think the fix for that crash is the following depressingly simply change. (The second hunk is to be safer in future while still reporting problems when debugging.) It's not absolutely certain it's the same problem, but I think there's a pretty good chance. I'll make another test build at some point. Index: Src/Zle/zle_refresh.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v retrieving revision 1.51 diff -u -r1.51 zle_refresh.c --- Src/Zle/zle_refresh.c 5 Jan 2008 13:12:56 -0000 1.51 +++ Src/Zle/zle_refresh.c 8 Jan 2008 14:56:53 -0000 @@ -797,7 +797,7 @@ (int)ZR_strlen(nbuf[0]) + rpromptw < winw - 1; } else { /* insert >.... on first line if there is more text before start of screen= */ - memset(nbuf[0], ZWC(' '), lpromptw); + ZR_memset(nbuf[0], ZWC(' '), lpromptw); t0 =3D winw - lpromptw; t0 =3D t0 > 5 ? 5 : t0; ZR_memcpy(nbuf[0] + lpromptw, ZWS(">...."), t0); @@ -1133,6 +1133,15 @@ if (!*ol) { i =3D (col_cleareol >=3D 0) ? col_cleareol : nllen; i -=3D vcs; + if (i < 0) { + /* + * This shouldn't be necessary, but it's better + * than a crash if there's a bug somewhere else, + * so report in debug mode. + */ + DPUTS(1, "BUG: badly calculated old line width in refresh"); + i =3D 0; + } zwrite(nl, i); vcs +=3D i; if (col_cleareol >=3D 0) --=20 Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070