mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix arrays.sh test failure under ASan (#411)
This backports a ksh2020 fix for an ASan heap-use-after-free error in
arrays.sh. The arrays regression tests were failing under ASan because
the ap pointer was used after the memory allocated to it was freed by
_nv_unset(). ksh2020 commit:
f1e5119e31
This commit is contained in:
parent
997f0e9dd8
commit
7c7fde75c8
1 changed files with 3 additions and 2 deletions
|
@ -519,8 +519,9 @@ void nv_setlist(register struct argnod *arg,register int flags, Namval_t *typ)
|
|||
}
|
||||
else if(((np->nvalue.cp && np->nvalue.cp!=Empty)||nv_isvtree(np)|| nv_arrayptr(np)) && !nv_type(np))
|
||||
{
|
||||
_nv_unset(np,NV_EXPORT);
|
||||
if(ap && ap->fun)
|
||||
int was_assoc_array = ap && ap->fun;
|
||||
_nv_unset(np,NV_EXPORT); /* this can free ap */
|
||||
if(was_assoc_array)
|
||||
nv_setarray(np,nv_associative);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue