Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: exim: dev

[Bug 1102] Exim should not abort on divide-by-zero

 

 

exim dev RSS feed   Index | Next | Previous | View Threaded


pdp at exim

Apr 12, 2011, 1:15 AM

Post #1 of 4 (489 views)
Permalink
[Bug 1102] Exim should not abort on divide-by-zero

------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1102

Phil Pennock <pdp [at] exim> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |pdp [at] exim
AssignedTo|nigel [at] exim |pdp [at] exim
Summary|Divide by zero in eval/acl |Exim should not abort on
|not reported in logs |divide-by-zero
Target Milestone|Exim 4.75 |Exim 4.76




--- Comment #1 from Phil Pennock <pdp [at] exim> 2011-04-12 09:15:55 ---
Exim 4.75:

% exim -be
> ${eval:10/0}
zsh: floating point exception exim -be

Well crap.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

--
## List details at http://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##


pdp at exim

Apr 12, 2011, 1:26 AM

Post #2 of 4 (478 views)
Permalink
[Bug 1102] Exim should not abort on divide-by-zero [In reply to]

------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1102

Phil Pennock <pdp [at] exim> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED




--- Comment #2 from Phil Pennock <pdp [at] exim> 2011-04-12 09:26:57 ---
This should now result in error messages in the log from the expansion failure.

http://git.exim.org/exim.git/commit/54e7ce4ad20a6977ee895a358259122bf3630090

% ./build-FreeBSD-amd64/exim -be
> ${eval:42/0}
Failed: error in expression evaluation: divide by zero (after processing
"42/0")

It will be up to the postmaster of a given install to construct their
arithmetic expressions to avoid trying to divide by zero, but Exim will no
longer die on FPE for this case.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

--
## List details at http://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##


git at exim

Apr 12, 2011, 2:17 AM

Post #3 of 4 (481 views)
Permalink
[Bug 1102] Exim should not abort on divide-by-zero [In reply to]

------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1102

Git Commit <git [at] exim> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |git [at] exim




--- Comment #3 from Git Commit <git [at] exim> 2011-04-12 10:17:05 ---
Git commit:
http://git.exim.org/exim.git/commitdiff/54e7ce4ad20a6977ee895a358259122bf3630090

commit 54e7ce4ad20a6977ee895a358259122bf3630090
Author: Phil Pennock <pdp [at] exim>
AuthorDate: Tue Apr 12 04:24:12 2011 -0400
Commit: Phil Pennock <pdp [at] exim>
CommitDate: Tue Apr 12 04:24:12 2011 -0400

Catch divide-by-zero in ${eval:...}.

Fixes 1102
---
doc/doc-txt/ChangeLog | 3 +++
src/src/expand.c | 11 ++++++++++-
2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index ce78086..e6684b4 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -21,6 +21,9 @@ PP/05 Don't segfault on misconfiguration of ref:name
exim-user as uid.
PP/06 Extra paranoia around buffer usage at the STARTTLS transition.
nb: Exim is not vulnerable to http://www.kb.cert.org/vuls/id/555316

+PP/07 Catch divide-by-zero in ${eval:...}.
+ Fixes bugzilla 1102.
+

Exim version 4.75
-----------------
diff --git a/src/src/expand.c b/src/src/expand.c
index bf425ae..06e0eb0 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -3107,7 +3107,16 @@ if (*error == NULL)
int y = eval_op_unary(&s, decimal, error);
if (*error != NULL) break;
if (op == '*') x *= y;
- else if (op == '/') x /= y;
+ else if (op == '/')
+ {
+ if (y == 0)
+ {
+ *error = US"divide by zero";
+ x = 0;
+ break;
+ }
+ x /= y;
+ }
else x %= y;
}
}


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

--
## List details at http://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##


pdp at exim

Apr 12, 2011, 1:31 PM

Post #4 of 4 (473 views)
Permalink
[Bug 1102] Exim should not abort on divide-by-zero [In reply to]

------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1102




--- Comment #4 from Phil Pennock <pdp [at] exim> 2011-04-12 21:31:06 ---
Steven A. Reisman pointed out that % 0 is also problematic.

Fixed.

Didn't tag the commit with the bug number, so:
http://git.exim.org/exim.git/commit/a5b5269546e02d1f2e90000e79df8409d4f269db


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

--
## List details at http://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##

exim dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.