Changeset: 8e31bbb080e4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8e31bbb080e4
Modified Files:
        monetdb5/modules/kernel/algebra.c
Branch: default
Log Message:

Improve casting to avoid overflow.


diffs (12 lines):

diff --git a/monetdb5/modules/kernel/algebra.c 
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -1052,7 +1052,7 @@ ALGfirstn(Client cntxt, MalBlkPtr mb, Ma
                }
                if (o > (lng) BATcount(b))
                        o = (lng) BATcount(b);
-               if (o + n > (lng) BATcount(b))
+               if ((BUN) o + (BUN) n > BATcount(b))
                        n = (lng) BATcount(b) - o;
                bn = BATdense(0, b->hseqbase + o, n);
                if (bn == NULL)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to