summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-01-14 13:46:30 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-01-14 13:46:30 +0000
commit64ba6ab2456265e7b03fa9aa2751b55dafdc41ee (patch)
treea33ead5dc3f214c23ceedf745eca125e6f7a6b45
parent126d3b946863ac578ddcee45c0e29f4e7c810983 (diff)
downloadzsh-64ba6ab2456265e7b03fa9aa2751b55dafdc41ee.tar.gz
zsh-64ba6ab2456265e7b03fa9aa2751b55dafdc41ee.zip
16448: math assignment bug introduced by 15291, 15292
-rw-r--r--ChangeLog6
-rw-r--r--Src/math.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b8d6a8aa1..f3a368fe6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-01-14 Peter Stephenson <pws@csr.com>
+
+ * 16448: Src/math.c: 15291, 15292 introduced bug that assignment
+ could be made in math eval even if a parameter retrieval gave
+ an error.
+
2002-01-14 Andrej Borsenkow <bor@zsh.org>
* 16443: Completion/Mandrake/Command/_urpmi: fix
diff --git a/Src/math.c b/Src/math.c
index 755026b6c..17796f244 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -497,7 +497,7 @@ pop(int noget)
if (mv->val.type == MN_UNSET && !noget)
mv->val = getnparam(mv->lval);
sp--;
- return mv->val;
+ return errflag ? zero_mnumber : mv->val;
}
/**/
@@ -630,6 +630,8 @@ op(int what)
DPUTS(sp < 1, "BUG: math: not enough wallabies in outback.");
b = pop(0);
a = pop(what == EQ);
+ if (errflag)
+ return;
if (tp & (OP_A2IO|OP_E2IO)) {
/* coerce to integers */
@@ -856,6 +858,8 @@ op(int what)
c = pop(0);
b = pop(0);
a = pop(0);
+ if (errflag)
+ return;
/* b and c can stay different types in this case. */
push(((a.type & MN_FLOAT) ? a.u.d : a.u.l) ? b : c, NULL, 0);
break;