From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29546 invoked by alias); 29 Jul 2010 09:07:42 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28105 Received: (qmail 19672 invoked from network); 29 Jul 2010 09:07:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Thu, 29 Jul 2010 10:07:37 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: [hamer@hamer.org.ua: Bug#590736: zsh: Segmentation fault in completion] Message-ID: <20100729100737.20053174@csr.com> In-Reply-To: <20100729044858.GA360@scru.org> References: <20100729044858.GA360@scru.org> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 29 Jul 2010 09:07:37.0313 (UTC) FILETIME=[7D3FD510:01CB2EFD] X-Scanned-By: MailControl A_09_40_00 (www.mailcontrol.com) on 10.71.0.135 On Thu, 29 Jul 2010 04:48:58 +0000 =D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80 =D0=9D=D0=BE=D0=B2= =D0=B8=D1=87=D0=B5=D0=BD=D0=BA=D0=BE wrote: > As you can see, problem is in spelling NULL-pointer in matcheq(). >=20 > For resolving ths bug, i propose use this patch: >=20 > diff -Naur zsh-4.3.10.orig/Src/Zle/compcore.c > zsh-4.3.10/Src/Zle/compcore.c --- zsh-4.3.10.orig/Src/Zle/compcore.c > 2009-01-13 12:15:38.000000000 +0000 +++ > zsh-4.3.10/Src/Zle/compcore.c 2010-07-27 22:58:40.726692827 > +0000 @@ -2932,7 +2932,7 @@ comp_setunset(0, 0, CP_EXACTSTR, 0); > } > ai->exactm =3D cm; > - } else if (useexact && !matcheq(cm, ai->exactm)) { > + } else if (useexact && (!ai->exactm || !matcheq(cm, ai->exactm)))= { > ai->exact =3D 2; > ai->exactm =3D NULL; > if (incompfunc)=20=20 Thanks, that looks entirely reasonable. It's clear from the code just below that ai->exactm can be NULL when ai->exact is non-zero, which appears to violate the assumption behind the previous code. Given it's a week's work to understand the completion code in enough detail to test the assumptions any further, I'll leave it at that. --=20 Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, = UK Member of the CSR plc group of companies. CSR plc registered in England and= Wales, registered number 4187346, registered office Churchill House, Cambr= idge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom