Changeset: 43a295665b61 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=43a295665b61
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        monetdb5/mal/Tests/tst235.mal
        monetdb5/mal/Tests/tst235.stable.out
        monetdb5/modules/mal/calc.c
        monetdb5/modules/mal/calc.mal
Branch: default
Log Message:

Avoid int-batid conversions
One should not be able to gain access to the BBP using an
arbitrary int expression.


diffs (109 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -2771,7 +2771,7 @@ command algebra.thetauselect(b:bat[:any_
 address ALGthetauselect;
 comment The theta (<=,<,=,>,>=) select() limited to head values
 
-command algebra.topN(b:bat[:oid,:any_1],top:lng):bat[:oid,:any_1] 
+command algebra.topN(b:bat[:any_1,:any_2],top:lng):bat[:any_1,:any_2] 
 address ALGtopN;
 comment Trim all but the top N tuples.
 
@@ -36569,14 +36569,6 @@ comment Cast VALUE to flt
 
 function calc.geomcollection{unsafe}(wkt:str):wkb;
 function calc.geometry{unsafe}(wkt:str):wkb;
-command calc.getBAT(b:int):bat[:any_1,:any_2] 
-address CALCbat2int;
-comment Coerce bat to BAT identifier
-
-command calc.getBATidentifier(b:bat[:any_1,:any_2]):int 
-address CALCbat2int;
-comment Coerce bat to BAT identifier
-
 pattern calc.hash(v:any):wrd 
 address MKEYhash;
 pattern calc.hash(v:dbl):wrd 
diff --git a/monetdb5/mal/Tests/tst235.mal b/monetdb5/mal/Tests/tst235.mal
--- a/monetdb5/mal/Tests/tst235.mal
+++ b/monetdb5/mal/Tests/tst235.mal
@@ -12,8 +12,6 @@ end dir;
 function createBAT(name:str):bat[:oid,:int];
     res:= bat.new(:oid,:int);
     bat.setName(res,name);
-    i:= calc.getBATidentifier(res);
-       j:= i; # now res should have 3 lrefs
        z:= bbp.getLRefCount(res);
        io.print(z);
     return res;
diff --git a/monetdb5/mal/Tests/tst235.stable.out 
b/monetdb5/mal/Tests/tst235.stable.out
--- a/monetdb5/mal/Tests/tst235.stable.out
+++ b/monetdb5/mal/Tests/tst235.stable.out
@@ -29,9 +29,6 @@ end dir;
 function user.createBAT(name:str):bat[:oid,:int];
     res := bat.new(:oid,:int);
     bat.setName(res,name);
-    i := calc.getBATidentifier(res);
-    j := i;
-# now res should have 3 lrefs 
     z := bbp.getLRefCount(res);
     io.print(z);
     return createBAT := res;
@@ -50,8 +47,8 @@ function user.main():void;
     io.print(i);
 # bat d should have 1 lref 
 end main;
-[ 2 ]
-[ 2 ]
+[ 1 ]
+[ 1 ]
 
 # 11:58:33 >  
 # 11:58:33 >  Done.
diff --git a/monetdb5/modules/mal/calc.c b/monetdb5/modules/mal/calc.c
--- a/monetdb5/modules/mal/calc.c
+++ b/monetdb5/modules/mal/calc.c
@@ -635,25 +635,6 @@ CMDsetoid(Client cntxt, MalBlkPtr mb, Ma
        return MAL_SUCCEED;
 }
 
-calc_export str CALCbat2int(int *ret, bat *b);
-
-str
-CALCbat2int(int *ret, bat *bid)
-{
-       BAT *b;
-
-       if (*bid == bat_nil) {
-               *ret = bat_nil;
-               return MAL_SUCCEED;
-       }
-       b = BATdescriptor(*bid);
-       if (b == 0)
-               return mythrow(MAL, "calc.getBAT", RUNTIME_OBJECT_MISSING);
-       *ret = b->batCacheid;
-       BBPkeepref(b->batCacheid);
-       return MAL_SUCCEED;
-}
-
 calc_export str CALCswitchbit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p);
 
 str
diff --git a/monetdb5/modules/mal/calc.mal b/monetdb5/modules/mal/calc.mal
--- a/monetdb5/modules/mal/calc.mal
+++ b/monetdb5/modules/mal/calc.mal
@@ -5009,13 +5009,6 @@ address CMDsetoid;
 pattern setoid(v:lng) :void
 address CMDsetoid;
 
-command getBATidentifier(b:bat[:any_1,:any_2]):int
-address CALCbat2int
-comment "Coerce bat to BAT identifier";
-command getBAT(b:int):bat[:any_1,:any_2]
-address CALCbat2int
-comment "Coerce bat to BAT identifier";
-
 pattern ifthenelse(b:bit,t:any_1,f:any_1):any_1
 address CALCswitchbit
 comment "If VALUE is true return MIDDLE else RIGHT";
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to