mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Applying the fix for 'unset -f' exposed a crashing bug in lookup()
in sh/nvdisc.c, which is the function for looking up discipline
functions. This is what caused tests/variables.sh to crash.
Ref.: https://github.com/ksh93/ksh/issues/23#issuecomment-645699614
src/cmd/ksh93/sh/nvdisc.c: lookup():
- To avoid segfault, check that the function pointer nq->nvalue.rp
is actually set before checking if nq->nvalue.rp->running==1.
src/cmd/ksh93/sh/xec.c,
src/cmd/ksh93/tests/functions.sh:
- Uncomment the 'unset -f' fix from b7932e87
.
Resolves #21 (again).
This commit is contained in:
parent
975117485c
commit
3e3f6b0f12
4 changed files with 9 additions and 8 deletions
|
@ -417,7 +417,7 @@ static char* lookup(Namval_t *np, int type, Sfdouble_t *dp,Namfun_t *handle)
|
|||
}
|
||||
if(bp== &block)
|
||||
block_done(bp);
|
||||
if(nq && nq->nvalue.rp->running==1)
|
||||
if(nq && nq->nvalue.rp && nq->nvalue.rp->running==1)
|
||||
{
|
||||
nq->nvalue.rp->running=0;
|
||||
_nv_unset(nq,0);
|
||||
|
|
|
@ -3505,16 +3505,11 @@ static void sh_funct(Shell_t *shp,Namval_t *np,int argn, char *argv[],struct arg
|
|||
nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);
|
||||
shp->pipepid = pipepid;
|
||||
np->nvalue.rp->running -= 2;
|
||||
/*
|
||||
* TODO: fix https://github.com/ksh93/ksh/issues/21
|
||||
* Following causes a memory fault in: bin/shtests -p variables
|
||||
*
|
||||
if(np->nvalue.rp && np->nvalue.rp->running==1)
|
||||
{
|
||||
np->nvalue.rp->running = 0;
|
||||
_nv_unset(np, NV_RDONLY);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue