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

Re: SegFault in stringsubst



On Apr 19,  2:03am, Andrew Waldron wrote:
}
} Seems like a similar check should be made for anonymous function
} arguments so that lastval will be set?

This is beginning to have knock-on effects that concern me.  E.g.:

* I don't know whether the lastval ternary test is the right thing, or
  if an unconditional return of 1 is appropriate (should lastval be
  checked in the code I already committed?);

* if we're testing errflag here, we should also do it when evaluating
  "for" and "select" loops (loop.c), which is pushing a new failure
  mode pretty far afield from the original bug;

* which means I'd be a lot happier if we were detecting this as a
  syntax error instead of a run-time error, but that may be pretty
  difficult to do.
 
} diff --git a/Src/exec.c b/Src/exec.c
} index f16cfd3..36b7efa 100644
} --- a/Src/exec.c
} +++ b/Src/exec.c
} @@ -4291,8 +4291,11 @@ execfuncdef(Estate state, UNUSED(int do_exec))
}  	    end += *state->pc++;
}  	    args = ecgetlist(state, *state->pc++, EC_DUPTOK, &htok);
}  
} -	    if (htok && args)
} +	    if (htok && args) {
}  		execsubst(args);
} +		if (errflag)
} +		    return lastval ? lastval : 1;
} +	    }
}  
}  	    if (!args)
}  		args = newlinklist();



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