Changeset: 72f287f44572 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/72f287f44572
Modified Files:
        gdk/gdk_batop.c
        monetdb5/modules/kernel/algebra.c
Branch: Dec2023
Log Message:

Allow ridiculously high limit in query.


diffs (58 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1831,16 +1831,13 @@ BATslice(BAT *b, BUN l, BUN h)
 
        BATcheck(b, NULL);
        BATiter bi = bat_iterator(b);
+       if (l > bi.count)
+               l = bi.count;
        if (h > bi.count)
                h = bi.count;
        if (h < l)
                h = l;
 
-       if (l > BUN_MAX || h > BUN_MAX) {
-               GDKerror("boundary out of range\n");
-               goto doreturn;
-       }
-
        if (complex_cand(b)) {
                /* slicing a candidate list with exceptions */
                struct canditer ci;
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
@@ -120,10 +120,6 @@ slice(BAT **retval, BAT *b, lng start, l
        }
        if (is_lng_nil(end))
                end = BATcount(b);
-       if (start > (lng) BUN_MAX || end >= (lng) BUN_MAX) {
-               GDKerror("argument out of range\n");
-               return GDK_FAIL;
-       }
 
        return (*retval = BATslice(b, (BUN) start, (BUN) end + 1)) ? 
GDK_SUCCEED : GDK_FAIL;
 }
@@ -969,8 +965,10 @@ ALGfirstn(Client cntxt, MalBlkPtr mb, Ma
        assert(pci->argc - pci->retc >= 5 && pci->argc - pci->retc <= 7);
 
        n = *getArgReference_lng(stk, pci, pci->argc - 4);
-       if (n < 0 || (lng) n >= (lng) BUN_MAX)
+       if (n < 0)
                throw(MAL, "algebra.firstn", ILLEGAL_ARGUMENT);
+       if (n > (lng) BUN_MAX)
+               n = BUN_MAX;
        ret1 = getArgReference_bat(stk, pci, 0);
        if (pci->retc == 2)
                ret2 = getArgReference_bat(stk, pci, 1);
@@ -1431,8 +1429,7 @@ ALGsubslice_lng(bat *ret, const bat *bid
        BAT *b, *bn;
        BUN s, e;
 
-       if (*start < 0 || *start > (lng) BUN_MAX ||
-               (*end < 0 && !is_lng_nil(*end)) || *end >= (lng) BUN_MAX)
+       if (*start < 0 || (*end < 0 && !is_lng_nil(*end)))
                throw(MAL, "algebra.subslice", ILLEGAL_ARGUMENT);
        if ((b = BBPquickdesc(*bid)) == NULL)
                throw(MAL, "algebra.subslice", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to