lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [3/3] git commit: refs/heads/master - Fix signed integer overflow in TestUtils.c
Date Tue, 29 Oct 2013 00:07:58 GMT
Fix signed integer overflow in TestUtils.c

Detected by clang's -fsanitize=undefined.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/344a875a
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/344a875a
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/344a875a

Branch: refs/heads/master
Commit: 344a875a2f90b317fcd7fdb6e6b8d7d7d7357026
Parents: 2104acd
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Tue Oct 29 01:05:09 2013 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Tue Oct 29 01:05:09 2013 +0100

----------------------------------------------------------------------
 clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/344a875a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
index a987d5c..3bf4d12 100644
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
+++ b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
@@ -41,7 +41,7 @@ TestUtils_random_u64() {
 int64_t*
 TestUtils_random_i64s(int64_t *buf, size_t count, int64_t min,
                       int64_t limit) {
-    uint64_t  range = min < limit ? limit - min : 0;
+    uint64_t  range = min < limit ? (uint64_t)limit - (uint64_t)min : 0;
     int64_t *ints = buf ? buf : (int64_t*)CALLOCATE(count, sizeof(int64_t));
     for (size_t i = 0; i < count; i++) {
         ints[i] = min + TestUtils_random_u64() % range;


Mime
View raw message