Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] don't let char class disturb end finding



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.



Messages sorted by: Reverse Date, Date, Thread, Author