git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Petter Urkedal <urkedal@nbi.dk>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Reserve a slot for argv[0] in default_arg.
Date: Sun, 4 Oct 2009 09:33:33 -0400	[thread overview]
Message-ID: <20091004133333.GA13894@sigill.intra.peff.net> (raw)
In-Reply-To: <1254576571-29274-1-git-send-email-urkedal@nbi.dk>

On Sat, Oct 03, 2009 at 03:29:31PM +0200, Petter Urkedal wrote:

> Setting "av" to one slot before the allocated "default_arg" array causes
> glibc abort with "free(): invalid next size (normal)" in some
> configurations (Gentoo, glibc-2.9_p20081201-r2, gcc-5.3.2 with PIE).

Thanks, your fix looks sane. But I am curious about whether we are
triggering some glibc pickiness that is in your setup, or if we are
somehow violating the assumption that we only ever look at
default_arg[1] and beyond.

What show-branch command did you issue to hit this? I was hoping to run
it under valgrind.

Also:

> +			if (!default_num)
> +			    /* One unused position for argv[0]. */
> +			    default_arg[default_num++] = NULL;

I don't know if we have a style rule for comments on single line
conditionals, but I had to read this a few times to make sure it wasn't
missing braces.

> -		ac = default_num + 1;
> -		av = default_arg - 1; /* ick; we would not address av[0] */
> +		ac = default_num;
> +		av = default_arg;

Any time you can remove a comment with "ick" in it is probably a good
thing.  ;)

-Peff

  reply	other threads:[~2009-10-04 13:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-03 13:29 [PATCH] Reserve a slot for argv[0] in default_arg Petter Urkedal
2009-10-04 13:33 ` Jeff King [this message]
2009-10-04 14:13   ` Petter Urkedal
2009-10-04 18:27     ` Jeff King
2009-10-04 20:02       ` Stephen Boyd
2009-10-04 22:20       ` Junio C Hamano
2009-10-05  6:36         ` Petter Urkedal
2009-10-05 18:45           ` Jeff King
2009-10-05  6:44       ` Petter Urkedal
2009-10-04 14:51   ` Petter Urkedal

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=20091004133333.GA13894@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=urkedal@nbi.dk \
    /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.
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).