zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: <zsh-workers@zsh.org>
Subject: Re: Complex config triggering Segfault in pattern matching code.
Date: Mon, 15 Dec 2014 15:39:36 -0800	[thread overview]
Message-ID: <141215153936.ZM17826@torch.brasslantern.com> (raw)
In-Reply-To: <CAAW2-Zft+xzCfSYF4O9F5TnaYqODdr8P_ZisPTPHQK8qyeGuVw@mail.gmail.com>

On Dec 15,  1:20pm, Jonathan H wrote:
}
} It usually is, but for some reason I can't get it to crash in
} valgrind.

That'll happen sometimes if the error is related to a signal being
handled or something like that.  Zsh isn't internally "multi-threaded"
so the only source of race conditions is signals (including child
process exits).

} Anyway, here's the STDERR from "valgrind -v -v".

That's probably more detail than is useful -- in fact, just "valgrind -q"
would probably suffice if you're going to run it for a long time.

} It shows some errors
} or something so maybe it's still of use. I'll post if I can get it to
} crash though.

==7806== 1 errors in context 1 of 2:
==7806== Source and destination overlap in strcpy(0x402bd24, 0x402bd51)
==7806==    at 0x4C2D766: __GI_strcpy (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7806==    by 0x488CD0: stringsubst (subst.c:301)

We can fix that one:

diff --git a/Src/subst.c b/Src/subst.c
index 43932c2..4100803 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -298,7 +298,7 @@ stringsubst(LinkList list, LinkNode node, int pf_flags, int asssub)
 	    if (endchar == Outpar)
 		str2--;
 	    if (!(s = (char *) ugetnode(pl))) {
-		str = strcpy(str2, str);
+		str = (char *)memmove(str2, str, strlen(str)+1);
 		continue;
 	    }
 	    if (!qt && (pf_flags & PREFORK_SINGLE) && isset(GLOBSUBST))


==7806== 2 errors in context 2 of 2:
==7806== Conditional jump or move depends on uninitialised value(s)
==7806==    at 0x65A79E7: execzlefunc (zle_main.c:1360)
==7806==    by 0x65B8B2C: bin_zle_call (zle_thingy.c:711)

I have no idea what to do with that one; that line is:

	Shfunc shf = (Shfunc) shfunctab->getnode(shfunctab, w->u.fnnam);



  reply	other threads:[~2014-12-15 23:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-13 19:49 Jonathan H
2014-12-13 23:28 ` Bart Schaefer
2014-12-13 23:36   ` Jonathan H
2014-12-14  4:40     ` Bart Schaefer
2014-12-14 18:20       ` Peter Stephenson
2014-12-14 18:43         ` Bart Schaefer
2014-12-15 21:20         ` Jonathan H
2014-12-15 23:39           ` Bart Schaefer [this message]
2014-12-16 20:58             ` Peter Stephenson
2014-12-17 17:18             ` Jonathan H
2014-12-18  6:14               ` Bart Schaefer
2014-12-18 19:09                 ` Peter Stephenson
2014-12-18 19:34                   ` Peter Stephenson
2014-12-29  0:57                   ` Daniel Shahaf

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=141215153936.ZM17826@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).