diff options
author | Bart Schaefer <schaefer@zsh.org> | 2024-01-24 18:00:16 -0800 |
---|---|---|
committer | Bart Schaefer <schaefer@zsh.org> | 2024-01-24 18:00:16 -0800 |
commit | 1f861ceba1d5740798caa0a3f208f3047c6e3ff5 (patch) | |
tree | b228d92657f722bedfc18972bcb4be7628ea59d5 /Src | |
parent | b3e763cc228b182019c22a3490312f7b17df4029 (diff) | |
download | zsh-1f861ceba1d5740798caa0a3f208f3047c6e3ff5.tar.gz zsh-1f861ceba1d5740798caa0a3f208f3047c6e3ff5.zip |
52492: prevent indexing error on recursive arithmetic in array subscript
Operator returns error when operand returns error
Diffstat (limited to 'Src')
-rw-r--r-- | Src/math.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Src/math.c b/Src/math.c index a060181ed..50b69d6a1 100644 --- a/Src/math.c +++ b/Src/math.c @@ -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) { |