Changeset: 4b09961eab7d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4b09961eab7d
Modified Files:
        gdk/gdk_sample.c
Branch: Oct2014
Log Message:

Don't cause overflow ((unsigned)0 - 1), and off-by-one error.
In case you request a sample larger than half the size of a BAT, these
two errors would occur.


diffs (21 lines):

diff --git a/gdk/gdk_sample.c b/gdk/gdk_sample.c
--- a/gdk/gdk_sample.c
+++ b/gdk/gdk_sample.c
@@ -113,7 +113,7 @@ OIDTreeToBATAntiset(struct oidtreenode *
        if (node->left != NULL)
                OIDTreeToBATAntiset(node->left, bat, start, node->o);
        else
-               for (noid = start+1; noid < node->o; noid++)
+               for (noid = start; noid < node->o; noid++)
                        ((oid *) bat->T->heap.base)[bat->batFirst + 
bat->batCount++] = noid;
 
         if (node->right != NULL)
@@ -212,7 +212,7 @@ BATsample(BAT *b, BUN n)
                if (!antiset) {
                        OIDTreeToBAT(tree, bn);
                } else {
-                       OIDTreeToBATAntiset(tree, bn, minoid - 1, maxoid + 1);
+                       OIDTreeToBATAntiset(tree, bn, minoid, maxoid);
                }
                OIDTreeDestroy(tree);
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to