zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: D04parameter.ztst crashes if USE_MMAP is not defined
Date: Wed, 28 Feb 2024 20:19:53 -0800	[thread overview]
Message-ID: <CAH+w=7aSyJuFASHnKexhn=ffxvygO78vG_af1uV5KEdSBQBF5A@mail.gmail.com> (raw)
In-Reply-To: <5A8A5063-D43C-4AD0-A03E-0A5E84259FFA@kba.biglobe.ne.jp>

On Wed, Feb 28, 2024 at 8:23 AM Jun. T <takimoto-j@kba.biglobe.ne.jp> wrote:
>
> line 4322 in subst.c is:
>             xlen = strlen(x);
> It seems x (= aval[0]) points to an already freed memory

If I step through this with gdb, x should point to the result of
dupstring("") from

3823        val = dupstring("");

(gdb) p aval
$19 = (char **) 0x7ffff7fbc4a0
(gdb) p val
$21 = 0x7ffff7fbc4a8 ""
(gdb) p x
$22 = 0x7ffff7fbc4a8 ""

0x7ffff7fbc4a0 is returned from hcalloc() here:

3945        return pm->u.str ? pm->u.str : (char *) hcalloc(1);

However, getting there is a bit questionable:

getvaluearr (v=0x7fffffffd120) at params.c:686

689        else if (PM_TYPE(v->pm->node.flags) == PM_ARRAY)
690        return v->arr = v->pm->gsu.a->getfn(v->pm);
(gdb) s
strgetfn (pm=0x5555555ebd95 <fetchvalue+1539>) at params.c:3944

Why is gsu.a->getfn pointed at strgetfn ?  I could imagine that does
the wrong thing from time to time.


  parent reply	other threads:[~2024-02-29  4:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 16:23 Jun. T
2024-02-29  2:41 ` Bart Schaefer
2024-02-29  4:19 ` Bart Schaefer [this message]
2024-03-01  9:57   ` Jun T
2024-03-03  5:33     ` 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='CAH+w=7aSyJuFASHnKexhn=ffxvygO78vG_af1uV5KEdSBQBF5A@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --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).