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

Re: [BUG] SIGSEGV under certain circumstances

On Mar 5,  9:09pm, Chi-Hsuan Yen wrote:
} Thanks for the tip. I re-compiled with commit
} 8522e996ecc88697344dcc4814367ec7e32e7deb and run zsh under valgrind.

Yes, this is much better, thank you.

The bad pointer dereference is in filename completion, not in the
history as I first suspected.

In computil.c:cfp_matcher_pats there is a loop that walks the string
from the command line, in this case the file name recalled from the
history, Comparing each character to the matcher pattern.  If it gets
a match it adjusts some counters that are initialized from strlen() of
the candidate string, exiting the loop when the counters reach the
end of the string.  It also adjusts pointers into string, and one of
those pointers is running past the end.

The pattern is m:{a-zA-Z}={A-Za-z} m:{a-zA-Z}={A-Za-z} but I don't
think that matters, it's the candidate string that's causing the

You can see the string in Yen's third backtrace - I won't attempt to
paste the string here because my mail client will probably mangle it:

It does not appear to be metafied but it contains some bytes that
were not in the original file name in his reproducing example.

So there seem to be two problems, one that the history is either not
saving or not reloading the Chinese characters correctly, and two
that the loop in cfp_matcher_pats is not counting correctly when it
examines that garbage string recalled from history.

I'm not in a good position multilingual-environment-wise to debug this
much further.  Peter, you were the last person to touch the computil.c
code in this area, though it was a long time ago --

commit 7f470ebcb09972d46e947dddf0c16197dd3a312f
Author: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxx>
Date:   Sat Oct 18 19:16:24 2008 +0000

    25912: fix another metafication bug in completion
    and remove lies about matchers

-- do you have any thoughts on what's going on?

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