mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-05-20 11:31:28 +02:00
52492: prevent indexing error on recursive arithmetic in array subscript
Operator returns error when operand returns error
This commit is contained in:
parent
b3e763cc22
commit
1f861ceba1
2 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
|||
2024-01-24 Bart Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 52492: Src/math.c: prevent indexing error when using recursive
|
||||
arithmetic in array subscript (operator stops on operand error)
|
||||
|
||||
* 52482: Src/subst.c: strip trailing newlines in emulation modes
|
||||
of ${ command; }, for bash/ksh compatibility
|
||||
|
||||
|
|
|
@ -352,6 +352,8 @@ getmathparam(struct mathvalue *mptr)
|
|||
}
|
||||
return zero_mnumber;
|
||||
}
|
||||
if (errflag)
|
||||
return zero_mnumber;
|
||||
}
|
||||
result = getnumvalue(mptr->pval);
|
||||
if (isset(FORCEFLOAT) && result.type == MN_INTEGER) {
|
||||
|
@ -1367,8 +1369,11 @@ op(int what)
|
|||
}
|
||||
|
||||
spval = &stack[sp].val;
|
||||
if (stack[sp].val.type == MN_UNSET)
|
||||
if (stack[sp].val.type == MN_UNSET) {
|
||||
*spval = getmathparam(stack + sp);
|
||||
if (errflag)
|
||||
return;
|
||||
}
|
||||
switch (what) {
|
||||
case NOT:
|
||||
if (spval->type & MN_FLOAT) {
|
||||
|
|
Loading…
Reference in a new issue