From: Bart Schaefer <schaefer@brasslantern.com>
To: Chi-Hsuan Yen <yan12125@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] SIGSEGV under certain circumstances
Date: Sun, 5 Mar 2017 08:00:54 -0800 [thread overview]
Message-ID: <170305080054.ZM24832@torch.brasslantern.com> (raw)
In-Reply-To: <CAMNjDR0A-c=Q3AD1hCrbas3YRJ1VXp68KbSLcdMDFH7JQYNdng@mail.gmail.com>
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
confusion.
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:
https://gist.github.com/yan12125/014c7a7510d1d9bd9ac8edf142a0c65d#file-gdb-backtrace-from-vgdb
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@users.sourceforge.net>
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?
next prev parent reply other threads:[~2017-03-05 16:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-01 15:38 Chi-Hsuan Yen
2017-03-04 23:11 ` Bart Schaefer
2017-03-05 12:55 ` Chi-Hsuan Yen
2017-03-05 13:09 ` Chi-Hsuan Yen
2017-03-05 16:00 ` Bart Schaefer [this message]
2017-03-05 16:17 ` Peter Stephenson
2017-03-05 18:42 ` Bart Schaefer
2017-03-05 18:52 ` Peter Stephenson
2017-03-05 21:45 ` Bart Schaefer
2017-03-05 22:31 ` Bart Schaefer
2017-03-05 22:41 ` Daniel Shahaf
2017-03-05 22:51 ` Bart Schaefer
2017-03-05 23:07 ` Bart Schaefer
2017-03-06 0:23 ` Bart Schaefer
2017-03-06 9:47 ` Peter Stephenson
2017-03-06 17:10 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=170305080054.ZM24832@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=yan12125@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).