about summary refs log tree commit diff homepage
path: root/lib/Solver/Solver.cpp
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2009-08-24 21:42:34 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2009-08-24 21:42:34 +0000
commit0f0b921714a32b51a1bbda1848a356bb4553f3d3 (patch)
treedfe22b3d08450a1b373f569d134b2b79287ab856 /lib/Solver/Solver.cpp
parent36c9fe87bb38d20850ca50d60facd019af54aa30 (diff)
downloadklee-0f0b921714a32b51a1bbda1848a356bb4553f3d3.tar.gz
Applied the patch submitted by Robby Cochran that fixes an arithmetic overflow in Solver::getRange().
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@79945 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Solver/Solver.cpp')
-rw-r--r--lib/Solver/Solver.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Solver/Solver.cpp b/lib/Solver/Solver.cpp
index abe88db7..5dd24273 100644
--- a/lib/Solver/Solver.cpp
+++ b/lib/Solver/Solver.cpp
@@ -164,7 +164,7 @@ std::pair< ref<Expr>, ref<Expr> > Solver::getRange(const Query& query) {
     // binary search for # of useful bits
     uint64_t lo=0, hi=width, mid, bits=0;
     while (lo<hi) {
-      mid = (lo+hi)/2;
+      mid = lo + (hi - lo)/2;
       bool res;
       bool success = 
         mustBeTrue(query.withExpr(
@@ -205,7 +205,7 @@ std::pair< ref<Expr>, ref<Expr> > Solver::getRange(const Query& query) {
       // binary search for min
       lo=0, hi=bits64::maxValueOfNBits(bits);
       while (lo<hi) {
-        mid = (lo+hi)/2;
+        mid = lo + (hi - lo)/2;
         bool res = false;
         bool success = 
           mayBeTrue(query.withExpr(UleExpr::create(e, 
@@ -229,7 +229,7 @@ std::pair< ref<Expr>, ref<Expr> > Solver::getRange(const Query& query) {
     // binary search for max
     lo=min, hi=bits64::maxValueOfNBits(bits);
     while (lo<hi) {
-      mid = (lo+hi)/2;
+      mid = lo + (hi - lo)/2;
       bool res;
       bool success = 
         mustBeTrue(query.withExpr(UleExpr::create(e,