[gcalctool] Fix crash doing bitwise operations with large numbers (Bug #637328)



commit da57e3f6ee33b64cd45277399e78ccbc29fca32a
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Mar 18 14:37:14 2011 +1100

    Fix crash doing bitwise operations with large numbers (Bug #637328)

 NEWS            |    1 +
 src/mp-binary.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index f129b86..2d30ea1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 Overview of changes in gcalctool 5.91.91
 
     * Disable localized digits (Bug #644980)
+    * Fix crash doing bitwise operations with large numbers (Bug #637328)
 
 Overview of changes in gcalctool 5.91.90
 
diff --git a/src/mp-binary.c b/src/mp-binary.c
index 968a210..d3c77c7 100644
--- a/src/mp-binary.c
+++ b/src/mp-binary.c
@@ -69,9 +69,10 @@ mp_bitwise(const MPNumber *x, const MPNumber *y, int (*bitwise_operator)(int, in
         offset_out = offset1 > offset2 ? offset1 : offset2;
     }
     if (offset_out > 0 && (offset_out < offset1 || offset_out < offset2)) {
-        mperr("Overflow. Try a bigger word size");
         g_free(text1);
         g_free(text2);
+        mp_set_from_integer(0, z);
+        mperr("Overflow. Try a bigger word size");
         return;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]