From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5964 invoked by alias); 18 Jun 2015 01:49:18 -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: 35513 Received: (qmail 9429 invoked from network); 18 Jun 2015 01:49:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 X-Helo: d03dlp01.boulder.ibm.com X-MailFrom: hanpt@linux.vnet.ibm.com X-RcptTo: zsh-workers@zsh.org Date: Thu, 18 Jun 2015 09:39:01 +0800 From: Han Pingtian To: zsh-workers@zsh.org Subject: Re: [PATCH] don't let char class disturb end finding Message-ID: <20150618013901.GA3494@localhost.localdomain> Mail-Followup-To: zsh-workers@zsh.org References: <20150617061628.GA27402@localhost.localdomain> <150617082305.ZM907@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <150617082305.ZM907@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15061801-0009-0000-0000-00000BC80F30 On Wed, Jun 17, 2015 at 08:23:05AM -0700, Bart Schaefer wrote: > On Jun 17, 2:16pm, Han Pingtian wrote: > } > } This patch try to fix this problem: > } > } compadd -M '[[:lower:]123456]=...' will cause the end of class to be the > } ']' before 1 and will alloc range of memory less than enough for the > } cpattern. > > I don't see anything obviously wrong with the patch, but when I try the > above example directly I get "unknown match specification character `['" > both before and after applying your patch (and no complaints of memory > misuse from valgrind, even before your patch). Is that the correct > example to reproduce the error? > > I also tried '[[:lower:]123456]=[[:upper:]abcdef]' with the same result. Sorry, my fault. It should be 'M:[[:lower:]123456]=[[:upper:]abcdef]' and for triggering memory misuse, I think we should use someting like 'M:[[:a:]123456]=[[:b:]abcdef]'. Then 469 optr = p->u.str = zhalloc((optr-iptr) + 1); will alloc a memory 5 bytes long, but latter it will put 6 bytes into this memory.