[Gmp-commit] /var/hg/gmp: Avoid signed overflow.

mercurial at gmplib.org mercurial at gmplib.org
Sun Jun 9 01:16:52 CEST 2013


details:   /var/hg/gmp/rev/3883c81ed605
changeset: 15826:3883c81ed605
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Sun Jun 09 01:16:45 2013 +0200
description:
Avoid signed overflow.

diffstat:

 ChangeLog           |  4 ++++
 mpn/generic/get_d.c |  2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 042c4020ce94 -r 3883c81ed605 ChangeLog
--- a/ChangeLog	Wed Jun 05 16:20:59 2013 +0200
+++ b/ChangeLog	Sun Jun 09 01:16:45 2013 +0200
@@ -1,3 +1,7 @@
+2013-06-09  Marc Glisse  <marc.glisse at inria.fr>
+
+	* mpn/generic/get_d.c (mpn_get_d): Avoid signed overflow.
+
 2013-05-31  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/generic/mu_div_q.c: Call mpn_mu_divappr_q for entire division,
diff -r 042c4020ce94 -r 3883c81ed605 mpn/generic/get_d.c
--- a/mpn/generic/get_d.c	Wed Jun 05 16:20:59 2013 +0200
+++ b/mpn/generic/get_d.c	Sun Jun 09 01:16:45 2013 +0200
@@ -135,7 +135,7 @@
      overflow.  After this exp can of course be reduced to anywhere within
      the {up,size} region without underflow.  */
   if (UNLIKELY ((unsigned long) (GMP_NUMB_BITS * size)
-		> (unsigned long) (LONG_MAX - exp)))
+		> ((unsigned long) LONG_MAX - exp)))
     {
 #if _GMP_IEEE_FLOATS
       goto ieee_infinity;


More information about the gmp-commit mailing list