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

Re: D04parameter.ztst crashes if USE_MMAP is not defined



On Wed, Feb 28, 2024 at 8:23 AM Jun. T <takimoto-j@xxxxxxxxxxxxxxxxx> 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.




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